Moosh.im emailing problem fixed
Minor update for users who have had trouble receiving email from the moosh.im server. This has affected some users who want to participate in the forum but never received their registration emails. This is not a mooshimeter-related blog entry, but I’m writing it down in case it helps someone.
Some users on moosh.im were not receiving registration and password reset emails.
Checking /var/log/maillog, I found many lines like the below.
Nov 30 17:42:24 ip-10-220-151-250 sendmail: uASLHwiA010761: to=<firstname.lastname@example.org>, ctladdr=<email@example.com> (48/48), delay=1+20:24:26, xdelay=00:00:01, mailer=esmtp, pri=4441319, relay=user.relay., dsn=4.0.0, stat=Deferred: 450 4.1.8 <firstname.lastname@example.org>: Sender address rejected: Domain not found
Certain mail servers are rejecting mail from sendmail because they can’t find a DNS record associated with the sender’s domain. Moosh.im is hosted on an Amazon EC2 instance, and in this case, the sender’s domain is Amazon’s default, “ip-10-220-151-250.us-west-2.compute.internal”. I never changed it when setting up the web server. Whoops.
Changing the server’s hostname is straightforward enough since I have a static IP address. It was a matter of editing the “HOSTNAME” line in /etc/sysconfig/network and rebooting. Your situation might be a little different, so check here.
However this created another problem. The moosh.im webserver also sends a lot of mail to moosh.im email addresses, which are hosted through Gmail. Since I changed the hostname to moosh.im, sendmail was treating all email addresses on the moosh.im domain as usernames and trying to send them locally, resulting in “User unknown” errors. To get around this, I had to force sendmail to defer to the public MX records whenever it sends mail to moosh.im. I used the solution from this page, adding:
to the bottom of /etc/mail/sendmail.mc and restarting sendmail
sudo service sendmail restart
And that was that. Hope someone finds this helpful.
No comments yet.