Closed rmmlopes closed 10 months 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.
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'}
...
But here, we create array of objects like [{'content-type': 'text/plain'}]
Nodemailer requires [{key: 'content-type', value: 'text/plain'}]
It has been fixed in this commit. But will be part of the upcoming major release.
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'
/**
Smtp driver to send email using smtp */ export class SmtpDriver implements SmtpDriverContract { private transporter: any
constructor(config: SmtpConfig) { this.transporter = nodemailer.createTransport(config) }
/**
message.headers = this.convertHeadersToNodemailFormat(message.headers)
return this.transporter.sendMail(message) }
/**
/**
BONUS (a sample repo to reproduce the issue)
https://github.com/rmmlopes/mail