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: 'sender@example.com',
to: 'recipient@example.com',
subject: 'List Message',
text: 'I hope no-one unsubscribes from this list!',
list: {
// List-Help: <mailto:admin@example.com?subject=help>
help: 'admin@example.com?subject=help',
// List-Unsubscribe: <http://example.com> (Comment)
unsubscribe: {
url: 'http://example.com',
comment: 'Comment'
},
// List-Subscribe: <mailto:admin@example.com?subject=subscribe>
// List-Subscribe: <http://example.com> (Subscribe)
subscribe: [
'admin@example.com?subject=subscribe',
{
url: 'http://example.com',
comment: 'Subscribe'
}
],
// List-Post: <http://example.com/post>, <mailto:admin@example.com?subject=post> (Post)
post: [
[
'http://example.com/post',
{
url: 'admin@example.com?subject=post',
comment: 'Post'
}
]
]
}
};