简体   繁体   中英

Send mail with email js with from address of my website title

I am using emailjs module of nodejs to send email. I am using gmail as my host and I have specified my username and password of my gmail account. It is sending email just fine but in from address it is using my name not my website title. I just want it to use my website tile.
Here is my code:

var server  = email.server.connect({
   user:    "myusername", 
   password:"mypassword", 
   host:    "smtp.gmail.com", 
   ssl:     true
});

var message = {
           text:    text_body, 
           from:    title,
           to:      first_name+' '+'<'+email+'>',
           subject: subject,
           attachment: 
           [
               {data: html_body, alternative:true}
           ]
};

server.send(message, function(err, message) { console.log(err || 'Mail sent'); });
 from: "whatever <your-email-at-google>"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM