NodeBB Email doesn't show From Name


  • Hi,

    I am using SendGrid to send email from NodeBB. I went to Settings > Email and add both email address (eg: me@domain.com) and from (eg: John Smith).

    The email I receive only shows the email address (me@domain.com) instead of John Smith <me@domain.com>

    Any idea what caused this issue?

    Thanks!

  • Community Rep

    @Mickola May be stating the obvious here but just to confirm: You did also set "From Name" when you set "Email Address"?

    I do not use Sendgrid but "works on my machine" with my smtp relays. At least with 12.x. Have yet to update to 13.x. So maybe a Sendgrid side issue?


  • @gotwf
    I've added both "Email Address" and "From Name". The NodeBB I am using now is v1.11.2, SendGrid plugin: 2.2.3.
    I check the plugin and index.js has the following:

    SendGrid.send({
      to: data.to,
      toname: data.toName,
      subject: data.subject,
      from: data.from,
      fromname: data.from_name || userData.username || undefined,
      text: data.text,
      html: data.html,
      headers: data.headers,
      reply_to: replyTo,
    }, next);
    

    So, it seems fromname doesn't return anything, not even userData.username. Any ideas?


  • I guess I found what the issue is. Apparently SendGrid API for Node.js doesn't seem to have fromname as one of its parameters. I modified the plugin and add a new line just before call SendGrid.send function.

    // Add this line
    data.from = data.from_name + '<' + data.from + '>';
    
    SendGrid.send({
      to: data.to,
      toname: data.toName,
      subject: data.subject,
      from: data.from,
      fromname: data.from_name || userData.username || undefined,
      text: data.text,
      html: data.html,
      headers: data.headers,
      reply_to: replyTo,
    }, next);
    

    Now, it's working!

  • Community Rep

    @Mickola I would be curious: can you run a test using NodeBB built-in rather than smtp relay service? Does it get populated then? Cuz I am suspicious you have a SendGrid issue here.

  • Community Rep

    @Mickola Ah, cool! Nevermind above then. Heh, glad you got it sorted. Less time that it too me to grab a fresh cup of coffee. Walk away, come back, and before I can refresh: Voila!! Rock on NodeBB!

  • Admin Staff

    @Mickola Feel free to send a pull request to https://github.com/julianlam/nodebb-plugin-emailer-sendgrid, if fromname isn't supported in the sengrid nodejs api that should be removed as well.

Suggested Topics

| |