简体   繁体   English

链接 Angular 表单并通过 email 获取表单值

[英]Linking Angular form and getting form values via email

I'm new to Angular and never hosted a website.我是 Angular 的新手,从未托管过网站。 I have a contact form and obviously need the inputs to my email when the form gets submitted.我有一个联系表格,当表格被提交时,显然需要我的 email 的输入。 How can I go about this我怎么能 go 关于这个

Pragmatic / simple solution务实/简单的解决方案

Probably not what you expected, but the simplest solution is a mailto link.可能不是您所期望的,但最简单的解决方案是 mailto 链接。 What it will do is it will start the user's email with a new email, and the to field filled in with the address you want.它将做的是它将用新的 email 启动用户的 email,并在to字段中填写您想要的地址。 You might be even able to prefill the subject and body, see https://css-tricks.com/snippets/html/mailto-links/ or search for mailto link .您甚至可以预先填写主题和正文,请参阅https://css-tricks.com/snippets/html/mailto-links/或搜索mailto link

Complete solution完整的解决方案

The angular app runs in the browser. angular 应用程序在浏览器中运行。 The browser can't send mails.浏览器无法发送邮件。 You need to have a backend, and a REST endpoint in it, where your angular app can post the contents of the contact form.您需要有一个后端和一个 REST 端点,您的 angular 应用程序可以在其中发布联系表单的内容。 The backend then can send an email with the contents of the contact form via any kind of email service, or your backend might have an email service (most probably it doesn't).然后后端可以通过任何类型的 email 服务发送带有联系表单内容的 email,或者您的后端可能有 email 服务(很可能它没有)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM