Score:0

"550 5.1.2 Relay not allowed" Error returned when trying to send emails from my on-premises mail server

sh flag

I setup an on premises mail server for my domain, to send and receive emails.

I've picked Stalwart mail server for this.

I deployed and configured the system, to the point which I am able to receive emails on my domain email addresses, but I've failed at making the system send emails properly.

It can send emails to my domain email addresses, but if I try to send an email to a gmail or yahoo account, I get errors like:

550 5.1.2 Relay not allowed.

Any idea what could be wrong? Thanks

My mail server logs generate when this error occurs are:

[2m2023-08-15T14:33:08.731705Z[0m[34mDEBUG[0m[1msession[0m[1m{[0m[3minstance[0m[2m=[0m"smtp"[3mprotocol[0m[2m=[0mSmtp[3mremote.ip[0m[2m=[0m"::ffff:138.229.16.231"[3mremote.port[0m[2m=[0m40426[1m}[0m[2m:[0m[2msmtp::inbound::ehlo[0m[2m:[0m[3mcontext[0m[2m=[0m"dnsbl"[3mevent[0m[2m=[0m"invalid-reply"[3mquery[0m[2m=[0m"7.e.0.1.5.e.a.8.f.f.f.f.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.zen.spamhaus.org."[3mreply[0m[2m=[0m[127.255.255.254]
[2m2023-08-15T14:33:10.481369Z[0m[35mTRACE[0m[1msession[0m[1m{[0m[3minstance[0m[2m=[0m"smtp"[3mprotocol[0m[2m=[0mSmtp[3mremote.ip[0m[2m=[0m"::ffff:138.229.16.231"[3mremote.port[0m[2m=[0m40426[1m}[0m[2m:[0m[2msmtp::inbound::session[0m[2m:[0m[3mevent[0m[2m=[0m"write"[3mdata[0m[2m=[0m"220 mail.queeq.com Stalwart SMTP at your service\r\n"[3msize[0m[2m=[0m50
[2m2023-08-15T14:33:10.484529Z[0m[35mTRACE[0m[1msession[0m[1m{[0m[3minstance[0m[2m=[0m"smtp"[3mprotocol[0m[2m=[0mSmtp[3mremote.ip[0m[2m=[0m"::ffff:138.229.16.231"[3mremote.port[0m[2m=[0m40426[1m}[0m[2m:[0m[2msmtp::inbound::session[0m[2m:[0m[3mevent[0m[2m=[0m"read"[3mdata[0m[2m=[0m"EHLO [192.168.1.95]\r\n"[3msize[0m[2m=[0m21
[2m2023-08-15T14:33:10.484624Z[0m[34mDEBUG[0m[1msession[0m[1m{[0m[3minstance[0m[2m=[0m"smtp"[3mprotocol[0m[2m=[0mSmtp[3mremote.ip[0m[2m=[0m"::ffff:138.229.16.231"[3mremote.port[0m[2m=[0m40426[1m}[0m[2m:[0m[2msmtp::inbound::ehlo[0m[2m:[0m[3mcontext[0m[2m=[0m"dnsbl"[3mevent[0m[2m=[0m"dnserror"[3mquery[0m[2m=[0m"[192.168.1.95].dbl.spamhaus.org."[3mreson[0m[2m=[0mDNS resolution error: proto error: Label contains invalid characters: Err(Errors { invalid_mapping, disallowed_by_std3_ascii_rules })
[2m2023-08-15T14:33:10.484697Z[0m[34mDEBUG[0m[1msession[0m[1m{[0m[3minstance[0m[2m=[0m"smtp"[3mprotocol[0m[2m=[0mSmtp[3mremote.ip[0m[2m=[0m"::ffff:138.229.16.231"[3mremote.port[0m[2m=[0m40426[1m}[0m[2m:[0m[2msmtp::inbound::ehlo[0m[2m:[0m[3mcontext[0m[2m=[0m"spf"[3mevent[0m[2m=[0m"lookup"[3midentity[0m[2m=[0m"ehlo"[3mdomain[0m[2m=[0m"[192.168.1.95]"[3mresult[0m[2m=[0mTempError
[2m2023-08-15T14:33:10.484750Z[0m[34mDEBUG[0m[1msession[0m[1m{[0m[3minstance[0m[2m=[0m"smtp"[3mprotocol[0m[2m=[0mSmtp[3mremote.ip[0m[2m=[0m"::ffff:138.229.16.231"[3mremote.port[0m[2m=[0m40426[1m}[0m[2m:[0m[2msmtp::inbound::ehlo[0m[2m:[0m[3mcontext[0m[2m=[0m"ehlo"[3mevent[0m[2m=[0m"ehlo"[3mdomain[0m[2m=[0m"[192.168.1.95]"
[2m2023-08-15T14:33:10.484844Z[0m[35mTRACE[0m[1msession[0m[1m{[0m[3minstance[0m[2m=[0m"smtp"[3mprotocol[0m[2m=[0mSmtp[3mremote.ip[0m[2m=[0m"::ffff:138.229.16.231"[3mremote.port[0m[2m=[0m40426[1m}[0m[2m:[0m[2msmtp::inbound::session[0m[2m:[0m[3mevent[0m[2m=[0m"write"[3mdata[0m[2m=[0m"250-mail.queeq.com says hello\r\n250-STARTTLS\r\n250-SMTPUTF8\r\n250-SIZE 104857600\r\n250-REQUIRETLS\r\n250-PIPELINING\r\n250-ENHANCEDSTATUSCODES\r\n250-CHUNKING\r\n250-BINARYMIME\r\n250 8BITMIME\r\n"[3msize[0m[2m=[0m180
[2m2023-08-15T14:33:10.489642Z[0m[35mTRACE[0m[1msession[0m[1m{[0m[3minstance[0m[2m=[0m"smtp"[3mprotocol[0m[2m=[0mSmtp[3mremote.ip[0m[2m=[0m"::ffff:138.229.16.231"[3mremote.port[0m[2m=[0m40426[1m}[0m[2m:[0m[2msmtp::inbound::session[0m[2m:[0m[3mevent[0m[2m=[0m"read"[3mdata[0m[2m=[0m"STARTTLS\r\n"[3msize[0m[2m=[0m10
[2m2023-08-15T14:33:10.489746Z[0m[35mTRACE[0m[1msession[0m[1m{[0m[3minstance[0m[2m=[0m"smtp"[3mprotocol[0m[2m=[0mSmtp[3mremote.ip[0m[2m=[0m"::ffff:138.229.16.231"[3mremote.port[0m[2m=[0m40426[1m}[0m[2m:[0m[2msmtp::inbound::session[0m[2m:[0m[3mevent[0m[2m=[0m"write"[3mdata[0m[2m=[0m"220 2.0.0 Ready to start TLS.\r\n"[3msize[0m[2m=[0m31
[2m2023-08-15T14:33:10.498472Z[0m[32m INFO[0m[1msession[0m[1m{[0m[3minstance[0m[2m=[0m"smtp"[3mprotocol[0m[2m=[0mSmtp[3mremote.ip[0m[2m=[0m"::ffff:138.229.16.231"[3mremote.port[0m[2m=[0m40426[1m}[0m[2m:[0m[2mutils::listener::listen[0m[2m:[0m[3mcontext[0m[2m=[0m"tls"[3mevent[0m[2m=[0m"handshake"[3mversion[0m[2m=[0mTLSv1_3[3mcipher[0m[2m=[0mTLS13_AES_256_GCM_SHA384
[2m2023-08-15T14:33:10.498565Z[0m[35mTRACE[0m[1msession[0m[1m{[0m[3minstance[0m[2m=[0m"smtp"[3mprotocol[0m[2m=[0mSmtp[3mremote.ip[0m[2m=[0m"::ffff:138.229.16.231"[3mremote.port[0m[2m=[0m40426[1m}[0m[2m:[0m[2msmtp::inbound::session[0m[2m:[0m[3mevent[0m[2m=[0m"read"[3mdata[0m[2m=[0m"EHLO [192.168.1.95]\r\n"[3msize[0m[2m=[0m21
[2m2023-08-15T14:33:10.498634Z[0m[35mTRACE[0m[1msession[0m[1m{[0m[3minstance[0m[2m=[0m"smtp"[3mprotocol[0m[2m=[0mSmtp[3mremote.ip[0m[2m=[0m"::ffff:138.229.16.231"[3mremote.port[0m[2m=[0m40426[1m}[0m[2m:[0m[2msmtp::inbound::session[0m[2m:[0m[3mevent[0m[2m=[0m"write"[3mdata[0m[2m=[0m"250-mail.queeq.com says hello\r\n250-SMTPUTF8\r\n250-SIZE 104857600\r\n250-REQUIRETLS\r\n250-PIPELINING\r\n250-ENHANCEDSTATUSCODES\r\n250-CHUNKING\r\n250-BINARYMIME\r\n250 8BITMIME\r\n"[3msize[0m[2m=[0m166
[2m2023-08-15T14:33:10.546754Z[0m[35mTRACE[0m[1msession[0m[1m{[0m[3minstance[0m[2m=[0m"smtp"[3mprotocol[0m[2m=[0mSmtp[3mremote.ip[0m[2m=[0m"::ffff:138.229.16.231"[3mremote.port[0m[2m=[0m40426[1m}[0m[2m:[0m[2msmtp::inbound::session[0m[2m:[0m[3mevent[0m[2m=[0m"read"[3mdata[0m[2m=[0m"MAIL FROM:<[email protected]> BODY=8BITMIME SIZE=410\r\n"[3msize[0m[2m=[0m51
[2m2023-08-15T14:33:10.792869Z[0m[34mDEBUG[0m[1msession[0m[1m{[0m[3minstance[0m[2m=[0m"smtp"[3mprotocol[0m[2m=[0mSmtp[3mremote.ip[0m[2m=[0m"::ffff:138.229.16.231"[3mremote.port[0m[2m=[0m40426[1m}[0m[2m:[0m[2msmtp::inbound::mail[0m[2m:[0m[3mcontext[0m[2m=[0m"iprev"[3mevent[0m[2m=[0m"lookup"[3mresult[0m[2m=[0mperm error; DNS record not found: Non-Existent Domain[3mptr[0m[2m=[0m""
[2m2023-08-15T14:33:10.836554Z[0m[34mDEBUG[0m[1msession[0m[1m{[0m[3minstance[0m[2m=[0m"smtp"[3mprotocol[0m[2m=[0mSmtp[3mremote.ip[0m[2m=[0m"::ffff:138.229.16.231"[3mremote.port[0m[2m=[0m40426[1m}[0m[2m:[0m[2msmtp::inbound::ehlo[0m[2m:[0m[3mcontext[0m[2m=[0m"dnsbl"[3mevent[0m[2m=[0m"invalid-reply"[3mquery[0m[2m=[0m"queeq.com.dbl.spamhaus.org."[3mreply[0m[2m=[0m[127.255.255.254]
[2m2023-08-15T14:33:10.886759Z[0m[34mDEBUG[0m[1msession[0m[1m{[0m[3minstance[0m[2m=[0m"smtp"[3mprotocol[0m[2m=[0mSmtp[3mremote.ip[0m[2m=[0m"::ffff:138.229.16.231"[3mremote.port[0m[2m=[0m40426[1m}[0m[2m:[0m[2msmtp::inbound::mail[0m[2m:[0m[3mcontext[0m[2m=[0m"spf"[3mevent[0m[2m=[0m"lookup"[3midentity[0m[2m=[0m"mail-from"[3mdomain[0m[2m=[0m"[192.168.1.95]"[3msender[0m[2m=[0m"[email protected]"[3mresult[0m[2m=[0mPass
[2m2023-08-15T14:33:10.886800Z[0m[34mDEBUG[0m[1msession[0m[1m{[0m[3minstance[0m[2m=[0m"smtp"[3mprotocol[0m[2m=[0mSmtp[3mremote.ip[0m[2m=[0m"::ffff:138.229.16.231"[3mremote.port[0m[2m=[0m40426[1m}[0m[2m:[0m[2msmtp::inbound::mail[0m[2m:[0m[3mcontext[0m[2m=[0m"mail-from"[3mevent[0m[2m=[0m"success"[3maddress[0m[2m=[0m"[email protected]"
[2m2023-08-15T14:33:10.886870Z[0m[35mTRACE[0m[1msession[0m[1m{[0m[3minstance[0m[2m=[0m"smtp"[3mprotocol[0m[2m=[0mSmtp[3mremote.ip[0m[2m=[0m"::ffff:138.229.16.231"[3mremote.port[0m[2m=[0m40426[1m}[0m[2m:[0m[2msmtp::inbound::session[0m[2m:[0m[3mevent[0m[2m=[0m"write"[3mdata[0m[2m=[0m"250 2.1.0 OK\r\n"[3msize[0m[2m=[0m14
[2m2023-08-15T14:33:10.891118Z[0m[35mTRACE[0m[1msession[0m[1m{[0m[3minstance[0m[2m=[0m"smtp"[3mprotocol[0m[2m=[0mSmtp[3mremote.ip[0m[2m=[0m"::ffff:138.229.16.231"[3mremote.port[0m[2m=[0m40426[1m}[0m[2m:[0m[2msmtp::inbound::session[0m[2m:[0m[3mevent[0m[2m=[0m"read"[3mdata[0m[2m=[0m"RCPT TO:<[email protected]>\r\n"[3msize[0m[2m=[0m28
[2m2023-08-15T14:33:10.891707Z[0m[34mDEBUG[0m[1msession[0m[1m{[0m[3minstance[0m[2m=[0m"smtp"[3mprotocol[0m[2m=[0mSmtp[3mremote.ip[0m[2m=[0m"::ffff:138.229.16.231"[3mremote.port[0m[2m=[0m40426[1m}[0m[2m:[0m[2msmtp::inbound::rcpt[0m[2m:[0m Relay not allowed.[3mcontext[0m[2m=[0m"rcpt"[3mevent[0m[2m=[0m"error"[3maddress[0m[2m=[0m"[email protected]"
[2m2023-08-15T14:33:15.893716Z[0m[35mTRACE[0m[1msession[0m[1m{[0m[3minstance[0m[2m=[0m"smtp"[3mprotocol[0m[2m=[0mSmtp[3mremote.ip[0m[2m=[0m"::ffff:138.229.16.231"[3mremote.port[0m[2m=[0m40426[1m}[0m[2m:[0m[2msmtp::inbound::session[0m[2m:[0m[3mevent[0m[2m=[0m"write"[3mdata[0m[2m=[0m"550 5.1.2 Relay not allowed.\r\n"[3msize[0m[2m=[0m30
[2m2023-08-15T14:33:15.908812Z[0m[35mTRACE[0m[1msession[0m[1m{[0m[3minstance[0m[2m=[0m"smtp"[3mprotocol[0m[2m=[0mSmtp[3mremote.ip[0m[2m=[0m"::ffff:138.229.16.231"[3mremote.port[0m[2m=[0m40426[1m}[0m[2m:[0m[2msmtp::inbound::session[0m[2m:[0m[3mevent[0m[2m=[0m"read"[3mdata[0m[2m=[0m""[3msize[0m[2m=[0m0
[2m2023-08-15T14:33:15.908834Z[0m[34mDEBUG[0m[1msession[0m[1m{[0m[3minstance[0m[2m=[0m"smtp"[3mprotocol[0m[2m=[0mSmtp[3mremote.ip[0m[2m=[0m"::ffff:138.229.16.231"[3mremote.port[0m[2m=[0m40426[1m}[0m[2m:[0m[2msmtp::inbound::spawn[0m[2m:[0m Connection closed by peer.[3mevent[0m[2m=[0m"disconnect"[3mreason[0m[2m=[0m"peer"
ws flag
Your logs are unreadable - can you repost them without the terminal escapes, pls. Also please provide details of your SPF, RMX, DKIM and DMARC settings.
Yonoss avatar
sh flag
@symcbean I've cleaned up the logs and attached a screenshot of my DNS configs. Thanks
cn flag
Why does the log say that the PTR DNS record is not found? What have you done to validate *all* of the required DNS records?
Yonoss avatar
sh flag
@GregAskew other than visually inspecting the configs and poking around MXToolbox, not much else. I am new to this king of setup. But your question made me realised that I missed something which seems to be fundamental in this problem: I haven't defined a rDNS entry for the mail server, as my host system is using a dynamic IP provided by my ISP. That being the case, is there any way to make it running without an rDNS entry? Thanks
Nikita Kipriyanov avatar
za flag
Virtually nobody accept mail from dynamic IP ranges, so no, you have to obtain a fixed IP address to run a mail server. And most mail systems (including gmail, for example) requires you to have a PTR record which is the same name as name your mailer uses as HELO; this implies the need of PTR record.
Score:0
cn flag

It seems that there is a DNS issue. Did you try to resolve any domain name on the server where Stalwart installed?

For example:

nslookup -q=mx gmail.com
Yonoss avatar
sh flag
This is what I get when I type that: [roo@fedora ~]$ nslookup -q=mx gmail.com Server: 127.0.0.53 Address: 127.0.0.53#53 Non-authoritative answer: gmail.com mail exchanger = 40 alt4.gmail-smtp-in.l.google.com. gmail.com mail exchanger = 20 alt2.gmail-smtp-in.l.google.com. gmail.com mail exchanger = 30 alt3.gmail-smtp-in.l.google.com. gmail.com mail exchanger = 5 gmail-smtp-in.l.google.com. gmail.com mail exchanger = 10 alt1.gmail-smtp-in.l.google.com. Authoritative answers can be found from:
Nikita Kipriyanov avatar
za flag
Please put such information [into your question](https://serverfault.com/posts/1141609/edit); it is unreadable in comments.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.