sendgrid-nodejs icon indicating copy to clipboard operation
sendgrid-nodejs copied to clipboard

Sender Name is not set when sending email via SMTP

Open jpaljasma opened this issue 12 years ago • 3 comments

Consider the following code:

var sendgrid = require("sendgrid")(sg_username, sg_password);
var Email = sendgrid.Email;
var email = new Email({
    to:        '[email protected]',
    from:       '[email protected]',
    fromname:   'This is my name',
    subject:    'Test subject',
    text:       'Test text',
    html:       '<h1>Test HTML Body</h1>'
});
sendgrid.send(email, function(err, json) {
    if (err) return console.log(err);
    console.log(json);
});

This will produce correct results, and you will receive correct From email header: From: This is my name <[email protected]>

By selecting to send email via SMTP:

var sendgrid  = require("sendgrid")(sg_username, sg_password, {api: 'smtp'});

the from name is missing. From: <[email protected]>

jpaljasma avatar Dec 06 '13 17:12 jpaljasma

Looking into this. In the meantime, I recommend switching to sending via HTTP. It's actually slightly faster (because SMTP is a chatty protocol) and is just if not more reliable internally in our system.

motdotla avatar Dec 10 '13 23:12 motdotla

Turns out this was also affecting toname.

motdotla avatar Dec 10 '13 23:12 motdotla

Fixed and in 0.4.6

motdotla avatar Dec 10 '13 23:12 motdotla