I am sending email using the Gmail APIs. The email is sent correctly, however the From address is not shown as I mentioned "Anup S via TestApp " . Instead it is simply showing the userID/email.
var email_lines = [];
email_lines.push("From: Anup S via TestApp <[email protected]>");
email_lines.push("To: [email protected]");
email_lines.push('Content-type: text/html;charset=iso-8859-1');
email_lines.push('MIME-Version: 1.0');
email_lines.push("Subject: New future subject here");
email_lines.push("");
email_lines.push("And the body text goes here");
email_lines.push("<b>And the bold text goes here</b>");
var email =email_lines.join("\r\n").trim();
var base64EncodedEmail = btoa(email);
var requestEmail = gapi.client.gmail.users.messages.send({
'userId': "me", // I also tried changing this - and (obviously) it does not work.
'message': {
'raw': base64EncodedEmail
}
});
Any ideas on how to fix this?
How about trying to add ' mark?
email_lines.push("From: 'Anup S via TestApp' <[email protected]>");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With