Blog

Moosh.im emailing problem fixed

Hi Reader,

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.

Problem

Some users on moosh.im were not receiving registration and password reset emails.

Diagnosis

Checking /var/log/maillog, I found many lines like the below.

Nov 30 17:42:24 ip-10-220-151-250 sendmail[12078]: uASLHwiA010761: to=<xxx@user.domain>, ctladdr=<apache@ip-10-220-151-250.us-west-2.compute.internal> (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 <apache@ip-10-220-151-250.us-west-2.compute.internal>: 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.

Solution

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:
define(MAIL_HUB',moosh.im.')dnl
define(LOCAL_RELAY',moosh.im.')dnl

to the bottom of /etc/mail/sendmail.mc and restarting sendmail
sudo /etc/mail/make
sudo service sendmail restart

And that was that.  Hope someone finds this helpful.

~James

No comments yet.

Leave a Reply

This site is protected by reCaptcha and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.

This site uses Akismet to reduce spam. Learn how your comment data is processed.