Nodemailer includes a helper for setting more complex List-* headers with ease. You can use this by providing message option list. It’s an object where key names are converted into list headers. List key help becomes List-Help header etc.
General rules
let message = {
from: '[email protected]',
to: '[email protected]',
subject: 'List Message',
text: 'I hope no-one unsubscribes from this list!',
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'
}
]
]
}
};