[英]How to make a button in HTML that will send the current page of a website via email?
假设我有一个网站,其中有一个按钮。 当您单击此按钮时,网站会将当前页面 html(作为 email 的正文或作为附件 ex:index.html)发送到特定的 email 地址。 这可能吗? 如果是这样,怎么做? (我想用 html 标签或 javascript 来做)。
这就像发送表单,但您发送的是 html 页面。
您所描述的似乎是NodeMailer的用例。 这里假设您使用 Node.js 作为后端。 其他语言有很多选项pypi-mailer是 python 的常用选项。
无论如何,您都需要一个 html 表格(或电子邮件的默认选项)
<form action="/sendMail">
<label for="email">Email: </label><br>
<input type="text" id="email" name="email" value="Enter your email"><br>
<input type="submit" value="Submit">
</form>
<p>If you click the "Submit" button, the form-data will be send to an endpoint /sendMail".</p>
然后你需要前端的 Javascript 才能真正得到 object。 我相信这个答案就是你在这里寻找的。
此链接解释了如何实际使用 nodemailer 发送 email。
希望这可以帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.