Issue
How can I send direct email via nodemailer
with DKIM enabled?
I tried
const nodemailer = require('nodemailer')
const directTransport = require('nodemailer-direct-transport')
const transporter = nodemailer.createTransport(
directTransport({
dkim: {
domainName: "mydomain.com",
keySelector: "mail",
privateKey: "<generated private key>"
}
}))
require('express')().get('/test', (req, res, next) => {
console.log('sending mail')
mailer.sendMail({
from: 'support@mydomain.com',
to: 'pmmEoRzqH5EyTO@dkimvalidator.com',
subject: 'test email',
html: 'Email content'
}, (err, reply) => {
console.log('email sent')
console.log(err && err.stack)
console.dir(reply)
})
res.send('test').end()
})
I also added the public key as TXT record to my DNS panel.
The email was sent but without DKIM as I checked at http://dkimvalidator.com/results
DKIM Information: DKIM Signature
This message does not contain a DKIM Signature
Is there anyone had succeed with this? This looks a straight forward cheap way to send email without setting up SMTP server but I did not see any post on this.
Solution
Finally, I figured out my own solution.
nodemailer
is big project but it looks lack of maintainer. Non-bug-report issue is closed by default.
I switched to sendmail then everything works like a charm
Answered By - transang Answer Checked By - Katrina (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.