Sendmail doesn't send email to same domain

July 8, 2015 1.3k views
Nginx DNS Ubuntu

Hi,
I'm using a thirdy part provider for email boxes and domain registration.
From this provider I've redirected my domain to a DO VPS running Ubuntu 14.04.
Using SENDMAIL if I send an email to xyzqwe@gmail.com (or @otherdomain.ext) all works great, but if I send an email to xyzqwe@SameVPSDomain.ext it doesn't work.
What is the problem?
Why from DO droplet I cannot send email to a thirdy part email provider??
Thanks in advance.

1 Answer

Hello,

This is happening most likely because your mail service thinks that mail sent to it's own configured hostname is handled locally. To fix this, open the /etc/mail/sendmail.mc file with your favorite text editor. If you use vim:

vim /etc/mail/sendmail.mc

Then go and edit the following. I'm using the domain SameVPSDomain.ext, but you want to replace that with whatever your domain name is.

define(`MAIL_HUB', `SameVPSDomain.ext')dnl
define(`LOCAL_RELAY', `SameVPSDomain.ext.')dnl

Save that, then recompile things and restart sendmail with:

sendmailconfig
service sendmail restart

This should route mail from your domain using DNS and the MX records for SameVPSDomain.ext instead of routing it locally.

Have another answer? Share your knowledge.