Nodemailer includes a helper for setting more complex List-* headers with ease. Use message option list
to provide all list headers. You do not need to add protocol prefix for the urls, or enclose the url between < and >, this is handled automatically.
If the value is a string, it is treated as an URL. If you want to provide an optional comment, use {url:'url', comment: 'comment'}
object. If you want to have multiple header rows for the same List-* key, use an array as the value for this key. If you want to have multiple URLs for single List-* header row, use an array inside an array.
List-* headers are treated as pregenerated values, this means that lines are not folded and strings are not encoded. Use only ascii characters and be prepared for longer header lines.
var mailOptions = {
list: {
// List-Help: <mailto:[email protected]?subject=help>
help: '[email protected]?subject=help',
// List-Unsubscribe: <http://example.com> (Comment)
unsubscribe: {
url: 'http://example.com',
comment: 'Comment'
},
// List-Subscribe: <mailto:[email protected]?subject=subscribe>
// List-Subscribe: <http://example.com> (Subscribe)
subscribe: [
'[email protected]?subject=subscribe',
{
url: 'http://example.com',
comment: 'Subscribe'
}
],
// List-Post: <http://example.com/post>, <mailto:[email protected]?subject=post> (Post)
post: [
[
'http://example.com/post',
{
url: '[email protected]?subject=post',
comment: 'Post'
}
]
]
}
};