I need to send a mail with a default message to the mail id specified by the user in the email field of an html form.I tried the below code which doesn't work.Is anything like URL queuing needed here.
<form method="POST" action="https://script.google.com/macros/s/AKfycbwIzz6c_PL7D9ioCrzDRvTdmBj2nZR-2ekUZ9pjgHeG3b3Simg/exec">
<label for="mail">Enter your mailID:</label>
<input type="email" id="mail" required>
<input type="submit">
</form>
Google script API:
function doPost(e){
var addr = JSON.stringify(e);
MailApp.sendEmail(addr,
"Recovery email for TracerSC",
"Your one time password ");
}
This is the error that I get
Invalid email: {"parameter":{},"contextPath":"","contentLength":0,"queryString":"","parameters":{}} (line 5, file "Code", project "email")
The below code which has the default mail id works fine for me
function doPost(){
MailApp.sendEmail("example@abc.com",
"Recovery email for TracerSC",
"Your one time password ");
}