Email Services Novice and issues sending to Gmail
-
I have never really done much with email in all my years of working on the web, and now I have a need. I have the NodeBB mailer setup with an SMTP email on my domain, and it works for pretty much everything except sending to Gmail accounts, and that is a problem.
I read:
https://community.nodebb.org/topic/15072/nodebb-email-options?_=1711731561044
It hits the high points but did not really help me on next steps. Is there a good guide for diagnosing and resolving issues? Or how to best setup an email provider to make sending more successful?
All input is appreciated.
-
@Chad-Augur Can you confirm if you have correct DNS records for
spf
,dmarc
anddkim
configured on your domain? -
There are:
@ TXT v=spf1........
_domainkey TXT v=DKIM1......I do not see a "dmarc" entry.
-
I did finally get a failure which is somewhat helpful, maybe the _dmarc will help this:
{ANaDDRESS}@gmail.com: host gmail-smtp-in.l.google.com[142.250.107.26] said:
550-5.7.1 [23.83.223.168] Messages missing a valid address in From: header,
or 550-5.7.1 having no From: header, are not accepted. For more
information, go to 550-5.7.1
https://support.google.com/mail/?p=RfcMessageNonCompliant and review 550
5.7.1 RFC 5322 specifications.
j2-20020aa78d02000000b006ea6d321d3bsi4398153pfe.89 - gsmtp (in reply to end
of DATA command)
Reporting-MTA: dns; relay.mailchannels.net
X-Postfix-Queue-ID: 3B6954C2AEC
X-Postfix-Sender: rfc822; {ANaDDRESS}@DOMAIN.EXT
Arrival-Date: Fri, 29 Mar 2024 23:22:31 +0000 (UTC)Final-Recipient: rfc822; {ANaDDRESS}@gmail.com
Original-Recipient: rfc822;{ANaDDRESS}@gmail.com
Action: failed
Status: 5.7.1
Remote-MTA: dns; gmail-smtp-in.l.google.com
Diagnostic-Code: smtp; 550-5.7.1 [23.83.223.168] Messages missing a valid
address in From: header, or 550-5.7.1 having no From: header, are not
accepted. For more information, go to 550-5.7.1
https://support.google.com/mail/?p=RfcMessageNonCompliant and review 550
5.7.1 RFC 5322 specifications.
j2-20020aa78d02000000b006ea6d321d3bsi4398153pfe.89 - gsmtp -
OK.... So I have added the _dmarc record and it has propagated.
To see if this could work I have setup a separate test using "nodemailer" with the following:
import nodemailer from 'nodemailer';
const mailit = (() => {
let transporter = nodemailer.createTransport({
host: 'smtp.HOST.EXT',
port: 465,
secure: true, // true for 465, false for other ports
auth: {
user: '[email protected]',
pass: 'XXXXXX', // Use the actual password
},
});let mailOptions = {
from: '"Test" [email protected]',
to: '[email protected]', // Use a test Gmail address
subject: 'Hello from Node',
text: 'This is a test email.',
};transporter.sendMail(mailOptions, (error, info) => {
if (error) {
console.log(error);
} else {
console.log('Email sent: ' + info.response);
}
});
})()export default mailit;
And this sends successfully to the test Gmail account I am using, no hitches. Leaving a very real chance that whatever is going on within NodeBB is not quite right. I am not sure where to look for that script as of right now. But the successful nodemailer test makes it the next place I will need to look.
-
For now I have hardcoded these two lines in emailer.js:
src/emailer.js#L317-L318
https://github.com/NodeBB/NodeBB/blob/master/src/emailer.js#L317-L318
from: '[email protected]',
from_name: 'Organization Name Forums'And with my specific values, it works. So something is amiss with:
from: meta.config['email:from'] ||
no-reply@${getHostname()}
,
from_name: meta.config['email:from_name'] || 'NodeBB',but I do not know what. It could be I missed configuring something.
-
Please take a look for something like Manage connections between your Google Account and third-parties within their knowledge base.
I don't know how it works on standard GMail service but configuring Google Workspace in such manner (allowing NodeBB as 3rd party app to send e-mails) solved similar problem for me.
Edit: sorry, you want to deliver e-mails. So you would like to configure things like reverse dns.
-
Word that from would bee messed up. Can you try undoing your change and
console.log
ing those values to see what they end up being?