Thursday, 8 June 2017

Nodemailer - get just the name from mail options object

I'm using Nodemailer and wondering how I can extract just the name value in the from property of the mail options. For example, given the example from Nodemailer docs:

// setup e-mail data with unicode symbols
var mailOptions = {
    from: '"Fred Foo ?" <foo@blurdybloop.com>', // sender address
    to: 'bar@blurdybloop.com, baz@blurdybloop.com', // list of receivers
    subject: 'Hello ✔', // Subject line
    text: 'Hello world ?', // plaintext body
    html: '<b>Hello world ?</b>' // html body
}; 

How might I go about getting the value Fred Foo to use on its own. Thanks for any help!



via mikeym

No comments:

Post a Comment