VPS WHM/cPanel setup - Emails - Default address, etc.

cvsouth

Member
Nov 4, 2013
11
0
1
cPanel Access Level
Root Administrator
Hi,

I am trying to get everything set up with WHM and cPanel on a CentOS 6 VPS. Pretty much everything is in place but one thing I haven't been able to get working is the email options through cPanel. I set up a default address for a domain on the account but when I send a test email to it I get an undelivered report.

I have a DNS control panel from the same company as the VPS which I set up records for each domain with, which includes MX records. I then add them as add-on domains by enabling remote domains. I am planning to set up private name servers any day now so I don't know if any of this would have any impact on the emails or what I am doing wrong.

Does anyone have any experience with getting emails working? Is there some SMTP config I need to do in WHM or something?

Thanks in advance
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,202
363
Hello :)

It sounds like the domain name's MX records may not yet point to your VPS. I recommend setting up name servers at your registrar and using those instead of entering custom DNS records.

Thank you.
 

cvsouth

Member
Nov 4, 2013
11
0
1
cPanel Access Level
Root Administrator
Hi Michael thanks for your response

I set up private name server (I think). I removed the add-on domains, removed DNS records from the VPS host, allowed shared nameserver IPs in tweak settings, set up and my one IP to the new nameservers ns1.mydomain.com and ns2.mydomain.com rather than ns0, ns1 and ns2.vpsdomain.com. I updated the nameservers for the domain from the domain registrar and re-added them as add-on domains in cPanel which worked.

I was hoping that emails would just start working after this but no luck. What I have noticed though is that once I remove the DNS records from the VPS provider for the domain, when I try to send emails to [email protected] I don't get an undelivered report anymore, but I also don't receive the email (it is set up with a default address forwarding to my gmail). So now it is like the email is lost completely.

Another things I've found out is that if I create an email account in cPanel, a) every account has all the emails on the server from the beginning of time and b) if I try to send an email through it, it says From address is invalid which is '[email protected]', so clearly something wrong there. Could this be a clue?

Are there any troubleshooting things I can do? Or are there any common things that I have missed completely?

Sorry for the long winded question
 

cvsouth

Member
Nov 4, 2013
11
0
1
cPanel Access Level
Root Administrator
I've been fiddling around with things,

When in cPanel I set the 'Default address' for a domain to 'Discard with error to sender (at SMTP time)', that works.

...But when I set it to forward to another email address, no luck.

So it seems like the email reaches the server because it is able to reject it with a custom message; but not able to forward it/send emails?

Anyone have any ideas?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,202
363
Do you notice any output to /var/log/exim_mainlog or /var/log/exim_reject log when you configure it to forward to another email address. Is the other email address a local or remote address?

Thank you.
 

cvsouth

Member
Nov 4, 2013
11
0
1
cPanel Access Level
Root Administrator
I set it to reject in cPanel and then sent an email, in /var/log/exim_rejectlog I have this:

Code:
2013-11-22 21:12:06 H=mail-lb0-f175.google.com [209.85.217.175]:47247 F=<[email protected]> rejected RCPT <[email protected]>: My custom reject message
I then changed it to forward to [email protected] instead of rejecting, and in /var/log/exim_mainlog I have this:

Code:
2013-11-22 21:16:42 SMTP connection from [209.85.215.53]:44949 (TCP/IP connection count = 1)
2013-11-22 21:16:43 SMTP connection identification D=mydomain.com [email protected] [email protected] M= U=myaccount ID=500 B=redirect_resolver
2013-11-22 21:16:43 1Vjy5j-0000p9-Ls <= [email protected] H=mail-la0-f53.google.com [209.85.215.53]:44949 P=esmtps X=TLSv1:RC4-SHA:128 S=1722 id=CAJF2zdDTLZVe+5_+43THwsTYZOtr_2Zk3pn3Kmv5e0EN[email protected] T="" for [email protected]
2013-11-22 21:16:43 cwd=/var/spool/exim 3 args: /usr/sbin/exim -Mc 1Vjy5j-0000p9-Ls
2013-11-22 21:16:43 1Vjy5j-0000p9-Ls SMTP connection identification D=mydomain.com [email protected] [email protected] M=1Vjy5j-0000p9-Ls U=myaccount ID=500 B=redirect_resolver
2013-11-22 21:16:43 1Vjy5j-0000p9-Ls SMTP connection outbound 1385155003 1Vjy5j-0000p9-Ls mydomain.com [email protected]
2013-11-22 21:16:43 SMTP connection from mail-la0-f53.google.com [209.85.215.53]:44949 closed by QUIT
2013-11-22 21:16:44 1Vjy5j-0000p9-Ls => [email protected] <[email protected]> R=lookuphost T=remote_smtp H=gmail-smtp-in.l.google.com [173.194.67.26] X=TLSv1:RC4-SHA:128 C="250 2.0.0 OK 1385155005 g2si901903wiw.8 - gsmtp"
2013-11-22 21:16:44 1Vjy5j-0000p9-Ls Completed
The email I'm trying to forward it to is my regular gmail
 

cvsouth

Member
Nov 4, 2013
11
0
1
cPanel Access Level
Root Administrator
Here is some more info:

When setting a default address, when set up to reject the email with a message in cPanel, that works fine. But when set to forward to an email address (gmail) the email just goes missing (see above).

I did an 'SMTP test' online and this was the results:

Connecting to <server IP address>
220-server.mydomain.com ESMTP Exim 4.82 #2 Fri, 29 Nov 2013 15:54:51 +0000
220-We do not authorize the use of this system to transport unsolicited,
220 and/or bulk e-mail. [1513 ms]
EHLO MXTB-PWS3.mxtoolbox.com
250-server.mydomain.com Hello mxtb-pws3.mxtoolbox.com [64.20.227.133]
250-SIZE 52428800
250-8BITMIME
250-PIPELINING
250-AUTH PLAIN LOGIN
250-STARTTLS
250 HELP [780 ms]
MAIL FROM: <[email protected]>
250 OK [780 ms]
RCPT TO: <[email protected]>
550-Please turn on SMTP Authentication in your mail client.
550-mxtb-pws3.mxtoolbox.com [64.20.227.133]:56547 is not permitted to relay
550 through this server without authentication. [1654 ms]

MXTB-PWS3v2 6178ms

This part would seem to be the important part:

550-Please turn on SMTP Authentication in your mail client.
550-mxtb-pws3.mxtoolbox.com [64.20.227.133]:56547 is not permitted to relay
550 through this server without authentication. [1654 ms]

I don't know how to fix it though, any suggestions?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,202
363
Have you checked to ensure the domain name is listed in the /etc/localdomains file on this system?

Thank you.
 

cvsouth

Member
Nov 4, 2013
11
0
1
cPanel Access Level
Root Administrator
Done some more digging

If I set up an email account in cPanel then I can send and receive emails through it as expected, so it would appear that the DNS and MX records are all ok and that exim is working properly?

mydomain.com is listed in /etc/localdomains

I checked in /etc/valiases/mydomain.com and it has the following:

Which also shows up when I run the Mail Troubleshooter in WHM for [email protected]

So it all appears to be set up properly

When I send an email to [email protected], expecting it to be forwarded to [email protected] via the default address, it just never arrives..

In /var/log/exim_mainlog I get:

2013-12-08 13:48:41 SMTP connection from [209.85.215.44]:37155 (TCP/IP connection count = 1)
2013-12-08 13:48:43 SMTP connection identification D=mydomain.com [email protected] [email protected] M= U=myaccount ID=500 B=redirect_resolver
2013-12-08 13:48:44 1Vpeiy-00008i-2n <= [email protected] H=mail-la0-f44.google.com [209.85.215.44]:37155 P=esmtps X=TLSv1:RC4-SHA:128 S=1728 [email protected]l.com T="subject" for [email protected]$
2013-12-08 13:48:44 SMTP connection from mail-la0-f44.google.com [209.85.215.44]:37155 closed by QUIT
2013-12-08 13:48:44 cwd=/var/spool/exim 3 args: /usr/sbin/exim -Mc 1Vpeiy-00008i-2n
2013-12-08 13:48:44 1Vpeiy-00008i-2n SMTP connection identification D=mydomain.com [email protected] [email protected] M=1Vpeiy-00008i-2n U=myaccount ID=500 B=redirect_resolver
2013-12-08 13:48:44 1Vpeiy-00008i-2n SMTP connection outbound 1386510524 1Vpeiy-00008i-2n mydomain.com [email protected]
2013-12-08 13:48:45 1Vpeiy-00008i-2n => [email protected] <[email protected]> R=lookuphost T=remote_smtp H=gmail-smtp-in.l.google.com [173.194.67.26] X=UNKNOWN:ECDHE-RSA-AES128-GCM-SHA256:128 C="250 2.0.0 OK 1386510526 q19si26$
2013-12-08 13:48:45 1Vpeiy-00008i-2n Completed
Any ideas? This is so frustrating

Thanks
 
Last edited:

cvsouth

Member
Nov 4, 2013
11
0
1
cPanel Access Level
Root Administrator
I just found out that it's only when I use the same email that it should be forwarded to, as the original sender, that it doesn't work. Is there any reason why it wouldn't do a round journey like that?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,202
363
I just found out that it's only when I use the same email that it should be forwarded to, as the original sender, that it doesn't work. Is there any reason why it wouldn't do a round journey like that?
Could you provide an example of this?

Thank you.