adonisjs / mail

AdonisJS Email Provider
MIT License
106 stars 34 forks source link

Custom headers not sent when using nodemailer #79

Closed rmmlopes closed 10 months ago

rmmlopes commented 2 years ago

Package version

7.2.5

Node.js and npm version

16.14.2 8.5.0

Sample Code (to reproduce the issue)

Mail headers do not get sent out if this isn't done.
I'm sure there is a more elegant way of doing this, but this is what got me going

/*

///

import nodemailer from 'nodemailer' import { MessageNode, SmtpMailResponse, SmtpDriverContract, SmtpConfig, } from '@ioc:Adonis/Addons/Mail'

/**

BONUS (a sample repo to reproduce the issue)

https://github.com/rmmlopes/mail

thetutlage commented 2 years ago

Please format your code properly. Also, the repo you have shared is the fork of the AdonisJS mail package. We need an example app that reproduces the issue.

M0nik commented 1 year ago

Same problem.

Nodemailer allow headers in format:

...
// allow {key:'content-type', value: 'text/plain'}
...
// allow [{key:'content-type', value: 'text/plain'}]
...
// allow {'content-type': 'text/plain'}
...

addHeader(key, value)

But here, we create array of objects like [{'content-type': 'text/plain'}]

Nodemailer requires [{key: 'content-type', value: 'text/plain'}]

thetutlage commented 10 months ago

It has been fixed in this commit. But will be part of the upcoming major release.

https://github.com/adonisjs/mail/commit/9da5f16e91b1e6800891b53ab6568ef2d3dad403#diff-60ea006d358dc5cddec873646d6aaae8ee58e5dcee845e71069a25b99ba126bbR265-R271