我有一个供人们填写的 HTML 表单,我希望当他们点击提交按钮时,它只会发送电子邮件,而不是调出他们的电子邮件并要求他们自己发送消息。
当我使用时:
<form action="MAILTO:emailaddress@email.com"... >
所做的只是打开一个新窗口并填充电子邮件正文,但我希望它只发送一封电子邮件。
有没有办法格式化电子邮件的输出格式?而不仅仅是字段名称和输入值的列表。
谢谢。
最佳答案
> 2021 年答案 = 简单使用 GMail 的方法(5 分钟)
我们昨天有一个类似的挑战要解决,我们使用 Google Apps 脚本解决了它!
通过 Google 从没有后端(服务器)的 HTML 表单发送电子邮件!
实现该解决方案需要 5 分钟,并且我已使用分步说明 进行了记录: https://github.com/nelsonic/html-form-send-email-via-google-script-without-server
简要概述
A.使用示例脚本部署 Google App 脚本
将示例脚本部署为 Google 电子表格应用程序脚本: google-script-just-email.js
remember to set the
TO_ADDRESS
in the script to where ever you want the emails to be sent.
and copy the APP URL so you can use it in the next step when you publish the script.
B.创建您的 HTML 表单并将 action
设置为 App URL
使用示例 html
文件:
index.html
创建一个基本表单。
remember to paste your APP URL into the form
action
in the HTML form.
C.在浏览器中测试 HTML 表单
在浏览器中打开 HTML 表单,输入一些数据并提交!
提交表格。您应该看到已发送的确认信息:
打开您设置的电子邮件地址的收件箱(上方)
完成。
Everything about this is customisable, you can easily style/theme the form with your favourite CSS Library and Store the submitted data in a Google Spreadsheet for quick analysis.
The complete instructions are available on GitHub:
https://github.com/nelsonic/html-form-send-email-via-google-script-without-server
关于html - 如何在电子邮件中发送 HTML 表单 .. 而不仅仅是 MAILTO,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7449767/