Josh_Katz
Josh_Katz

Reputation: 137

Heroku Intercepting Some Gmail Incoming Messages

I am serving my Rails 3 app on Heroku, my mail through Google, and the domain through Enom. This is for www.challengage.com

This works 95% of the time, however, once in a while, when someone tries to reply to an email I send them, it fails with the below error message because my email, [email protected], somehow got replaced with [email protected] when they recieved it. I think it has something to do with Mail Delivery Subsystems, but I'm not sure. It also only seems to happen when emailing University professionals.

Error Message:

    From: Mail Delivery Subsystem [mailto:[email protected]]
Sent: Monday, July 15, 2013 2:08 PM
To: David DiMaggio
Subject: Undeliverable: FW: Challengage - Work Team Simulation product for interviewing evaluations

Delivery has failed to these recipients or groups:

[email protected]
The server has tried to deliver this message, without success, and has stopped trying. Please     try sending this message again. If the problem continues, contact your helpdesk.


The following organization rejected your message: challengage.herokuapp.com.

Any ideas?

Thanks everyone.

Upvotes: 1

Views: 149

Answers (1)

Steve Smith
Steve Smith

Reputation: 5211

This is almost certainly because you're using a CNAME for your email records.

Although most email servers will reflect the original domain when sending a message, others will replace it with the domain that's at the end of the CNAME.

This means that instead of sending to [email protected] they send to [email protected] instead.

The mail server sees the request to send to [email protected] and decides that it doesn't look after challengage.herokuapp.com and so from it's perspective the message is rejected.

We used to see this issue with CloudMailin customers and started to recommend that they don't use CNAMES where email is involved and just make use of adding MX records direct to the Apex domain.

With Heroku this poses a problem though as you don't have a single IP that you can use to access their servers. We eventually ended up using Route 53 to host our domain, then adding an SSL endpoint (to get load balancer details) and then adding that load balancer to Route 53's Alias command so that it automatically always gave the correct results. Alternatively you can setup some sort of static IP based system on your apex domain to redirect.

Upvotes: 1

Related Questions