im sending otp email verification code to my users from my custom domain email with nodemailer package. I set dkim signature and it was working 3 months ago and my email was falling to incomebox. But some how after 3 months, when i try exactly same code and exactly same thing, mail falls to junk box and when i check mail header i see this: smtp.mailfrom=<$_MYDOMAIN>.com; dkim=fail (no key for signature) my code is below:
let transporter = nodemailer.createTransport(
{
host: process.env.AUTH_EMAIL_HOST,
port: process.env.AUTH_EMAIL_PORT,
secure: true,
dkim: {
domainName: process.env.DKIM_DOMAIN,
keySelector: process.env.DKIM_SELECTOR,
privateKey: fs.readFileSync(process.env.DKIM_PRIVATE_KEY_FILE_PATH, "utf8"),
cacheDir: '/tmp',
cacheTreshold: 2048,
},
auth: {
user: process.env.AUTH_EMAIL,
pass: process.env.AUTH_PASS,
}
}
);
const otp = `${Math.floor(100000 + Math.random() * 900000)}`
//mail options
const mailOptions = {
from: process.env.AUTH_EMAIL,
to: email,
subject: "Verify your email",
html: `<p>Enter <b>${otp}</b> in the app to verify your email adress and complate the signup</p>
<p>This code <b>expires in 1 hour</b></p>`,
};
and my nodemailer version is: "nodemailer": "^6.9.2", (just updated and also tried old versions, still it was not working)
(im sure dkim key and signature set on email hosting because it was working properly and i didn't change anything...) what do you guys think problem can be? thanks a lot in advance for your guidness