Question

Sendmail doesn't send email to same domain

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.

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

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.