How to setup correct from email in WHM?

Operating System & Version
CentOS
cPanel & WHM Version
7.9

CharlesGLondon

Active Member
Jan 30, 2019
29
3
3
London
cPanel Access Level
Website Owner
Emails send from server's root are being returned by 1&1 email host with following error.

# echo "Subject: sendmail test" | sendmail -v [email protected]

SMTP>> MAIL FROM:<[email protected]> SIZE=1328
SMTP<< 550-Requested action not taken: mailbox unavailable
550 invalid DNS MX or A/AAAA resource record
SMTP>> QUIT

I tried sending to gmail where it is delivered but goes to spam folder.

So it seems that my server/WHM is not correctly setup for email sender (root).

Following are my settings
WHM >> Change System Mail Preferences
Cpanel root
Nobody Blank
root "my e-mail address"

/etc/localdomains
It has the server name ns512222 listed there.

I suspect, and probably it's obvious, that ns512222 is not a FQDN? Is this is the reason? How to fix it?
 

quietFinn

Well-Known Member
Feb 4, 2006
1,659
333
438
Finland
cPanel Access Level
Root Administrator
Where are the MX record(s) of domain.com pointing to?
Is domain.com in /etc/localdomains ?

It looks like the mail is delivered to the local server but there is no such mailbox.
 
  • Like
Reactions: cPanelAnthony

quietFinn

Well-Known Member
Feb 4, 2006
1,659
333
438
Finland
cPanel Access Level
Root Administrator
But for some reason Exim in your server is trying to do local delivery.
Is the DNS Zone for domain.com in your server?

> I suspect, and probably it's obvious, that ns512222 is not a FQDN? Is this is the reason? How to fix it?
It's not a FQDN but it's not the reason.
 

CharlesGLondon

Active Member
Jan 30, 2019
29
3
3
London
cPanel Access Level
Website Owner
But for some reason Exim in your server is trying to do local delivery.
Is the DNS Zone for domain.com in your server?
No, DNS zone for domain.com is not on my server, it never has been.

Following is the complete log

#echo "Subject: sendmail test" | sendmail -v [email protected]
LOG: MAIN
cwd=/root 3 args: sendmail -v [email protected]
LOG: MAIN
<= [email protected] U=root P=local S=296 T="sendmail test"
[[email protected] ~]# LOG: MAIN
cwd=/var/spool/exim 4 args: /usr/sbin/exim -v -Mc 1moq7t-0008Fs-Ne
delivering 1moq7t-0008Fs-Ne
Connecting to mx00.1and1.co.uk [113.111.11.11]:25 ... connected
SMTP<< 220 kundenserver.de (mxeue010) Nemesis ESMTP Service ready
SMTP>> EHLO ns512222.ip-123-49-15.net
SMTP<< 250-kundenserver.de Hello ns512222.ip-123-49-15.net [111.11.11.11]
250-8BITMIME
250-SIZE 157286400
250 STARTTLS
SMTP>> STARTTLS
SMTP<< 220 OK
LOG: MAIN
[113.111.11.11] SSL verify error: certificate name mismatch: DN="/C=DE/O=IONOS SE/ST=Rheinland-Pfalz/L=Montabaur/CN=mx.kundenserver.de" H="mx00.1and1.co.uk"
SMTP>> EHLO ns512222.ip-123-49-15.net
SMTP<< 250-kundenserver.de Hello ns512222.ip-123-49-15.net [111.11.11.11]
250-8BITMIME
250 SIZE 157286400
SMTP>> MAIL FROM:<[email protected]> SIZE=1328
SMTP<< 550-Requested action not taken: mailbox unavailable
550 invalid DNS MX or A/AAAA resource record
SMTP>> QUIT
SMTP(close)>>
LOG: MAIN
** [email protected] R=lookuphost T=remote_smtp H=mx00.1and1.co.uk [113.111.11.11] X=TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256 CV=no: SMTP error from remote mail server after MAIL FROM:<[email protected]> SIZE=1328: 550-Requested action not taken: mailbox unavailable\n550 invalid DNS MX or A/AAAA resource record
LOG: MAIN
cwd=/var/spool/exim 8 args: /usr/sbin/exim -v -t -oem -oi -f <> -E1moq7t-0008Fs-Ne
LOG: MAIN
<= <> R=1moq7t-0008Fs-Ne U=mailnull P=local S=1848 T="Mail delivery failed: returning message to sender"
LOG: MAIN
Completed
LOG: MAIN
cwd=/var/spool/exim 4 args: /usr/sbin/exim -v -Mc 1moq7u-0008G6-UG
delivering 1moq7u-0008G6-UG
LOG: MAIN
Sender identification U=mailnull D=-system- S=mailnull
Connecting to mx00.1and1.co.uk [113.111.11.11]:25 ... connected
SMTP<< 220 kundenserver.de (mxeue010) Nemesis ESMTP Service ready
SMTP>> EHLO ns512222.ip-123-49-15.net
SMTP<< 250-kundenserver.de Hello ns512222.ip-123-49-15.net [111.11.11.11]
250-8BITMIME
250-SIZE 157286400
250 STARTTLS
SMTP>> STARTTLS
SMTP<< 220 OK
LOG: MAIN
[113.111.11.11] SSL verify error: certificate name mismatch: DN="/C=DE/O=IONOS SE/ST=Rheinland-Pfalz/L=Montabaur/CN=mx.kundenserver.de" H="mx00.1and1.co.uk"
SMTP>> EHLO ns512222.ip-123-49-15.net
SMTP<< 250-kundenserver.de Hello ns512222.ip-123-49-15.net [111.11.11.11]
250-8BITMIME
250 SIZE 157286400
SMTP>> MAIL FROM:<> SIZE=2926
SMTP<< 250 Requested mail action okay, completed
SMTP>> RCPT TO:<[email protected]>
SMTP<< 250 OK
SMTP>> DATA
SMTP<< 354 Start mail input; end with <CRLF>.<CRLF>
SMTP>> writing message and terminating "."
SMTP<< 250 Requested mail action okay, completed: id=1N9eg1-1md2UA3EWL-015Uwb
SMTP>> QUIT
SMTP(close)>>
LOG: MAIN
=> [email protected] <[email protected]> R=dkim_lookuphost T=dkim_remote_smtp H=mx00.1and1.co.uk [113.111.11.11] X=TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256 CV=no C="250 Requested mail action okay, completed: id=1N9eg1-1md2UA3EWL-015Uwb"
LOG: MAIN
Completed
 

quietFinn

Well-Known Member
Feb 4, 2006
1,659
333
438
Finland
cPanel Access Level
Root Administrator
I would suggest that you correct your hostname, in WHM -> Networking Setup -> Change Hostname.
 

quietFinn

Well-Known Member
Feb 4, 2006
1,659
333
438
Finland
cPanel Access Level
Root Administrator
Somethign seems to be wrong because I see:

>SMTP>> MAIL FROM:<[email protected]> SIZE=1328
(unless you changed that).

Just to make sure change (or set) the hostname again.
 

CharlesGLondon

Active Member
Jan 30, 2019
29
3
3
London
cPanel Access Level
Website Owner
Somethign seems to be wrong because I see:

>SMTP>> MAIL FROM:<[email protected]> SIZE=1328
(unless you changed that).

Just to make sure change (or set) the hostname again.
Yes, you are right. This is what I meant in my very first question. ns512222 is not hostname. I'm not sure where this value is coming from. The only place I could find this value is in /etc/localdomains, is this the place where it's getting this value? if not where else to look for ns512222 value?