node.js - Getting email Bounce when using gmail nodejs api -


this code using send email.

function sendmessage(auth) {  var gmail =google.gmail('v1');   var email_lines =[];  email_lines.push("from:a@gmail.com");  email_lines.push("to:b@gmail.com");  email_lines.push('content-type:text/html;charset=iso-8859-1');  email_lines.push('mime-version:1.0');  email_lines.push("subject:testing ");  email_lines.push("hi,");  email_lines.push("testing");  email_lines.push("<b>hi</b>");   var email =email_lines.join("\r\n").trim();  var base64encodedemail = new buffer(email).tostring('base64');  base64encodedemail=base64encodedemail.replace(/\//g,'_').replace(/\+/g,'-'); gmail.users.messages.send({   auth,  'userid': 'me',  'resource': {      'raw': base64encodedemail    }  },function(err, response) {  if (err) {    console.log('the api returned error: ' + err);    return;  } console.log(response); }); } 

i receiving bounce emails `an error occurred. message not sent.

hi, testing hi date: tue, 8 nov 2016 01:35:08 -0800 message-id:`

please help.

@tholle - works me, empty line gives me trouble.

i testing javascript, below working raw email:

from: xxx@gmail.com to: xxx@gmail.com subject: test subject reply-to: xxx@gmail.com date: fri dec 30 2016 09:54:09 gmt-0500 (est)  test body 

some post says reply-to required, think date here not required.


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - IE9 error '$'is not defined -