Monday, January 3, 2011

How replies are routed when you send a transactional email to an email-to-SMS gateway address

We recently had a JangoSMTP client report to us that when they used JangoSMTP to send an email message to an SMS-gateway address, that replies didn't go to the From Address. We investigated and found that transactional emails sent to SMS-gateway email addresses replies routed not to the From Address, but to the SMTP level MAIL-FROM used during the SMTP transaction.

The MAIL-FROM address is also known as the "envelope sender" or the "Return Path".

The MAIL-FROM address is a different part of the email message than the regular From Address which most recipients see. The MAIL-FROM address is used during the communication between two servers as an email message is sent. In our research we've found that the MAIL-FROM only ever receives replies if the email is sent to an SMS gateway email address.

To make sense of the technical details, it's easiest to look at an example. I use T-Mobile for my BlackBerry. My mobile number is 937-838-0921 (I've altered the number to protect my phone from ringing off the hook after this post.) Anyone can send me an SMS message by sending an email to is the domain T-Mobile is using for their email-to-SMS gateway. If you send an email to, that email message generates an SMS to my BlackBerry.

[Above is an email message "from" that generates the SMS]

[Above is the SMS message on my BlackBerry]

Let's examine the SMS message on my BlackBerry. Notice that the From Address of shows in the message, but it's not the From Address of the message, because SMS messages don't have From Addresses. The sender of an SMS message is usually a mobile number or a short-code, but in this case, the sender is simply shown as 3662. The actual text of the SMS message is a concatenation of the various parts of my original email...specifically, the text of the SMS message is my email's From Address plus its Subject plus its Message.

Therefore replying to this text will not send an email to It sends it to a T-Mobile system, identified by the number 3662.

T-Mobile receives the reply and then sends an email, but where will T-Mobile send this email? One would guess that the reply would be routed to the From Address of the original email (, but in fact the reply is routed to the MAIL-FROM of the original email ( In this case, "ajay.goel" is the username of the JangoSMTP account used to send the email, which is why the MAIL-FROM is

The MAIL-FROM address is shown in the SMTP log of the original email message:

Why do replies to text messages work this way?

We don't know exactly, and our research into how SMS works hasn't provided any answers. We've verified that replies work this way on both T-Mobile's and AT&T's networks. Our best guess is that mobile phone companies all use the same software to translate email messages into text messages, and during the transmission of the email to the SMS gateway, the first address seen is captured and stored as the reply address. Since an actual SMS message doesn't have a property for a return email address, the mobile network must store the reply address on its end, outside of what the mobile phone user sees, and then associate that reply address with the SMS user's response to the 4-digit sender code (3662 in the above example). The first address that's seen is the MAIL-FROM address during the initial SMTP communication, and therefore that becomes the reply address that the mobile company uses.

What happens when an email is sent to

JangoSMTP is intelligent enough to receive the email sent to, identify the email as a legitimate reply to your message, and then forward the message to an email address of your choosing. Any legitimate reply email messages sent to a MAIL-FROM address that is controlled by JangoSMTP, such as any addresses, are then forwarded to the address that you used when you first created your JangoSMTP account. This can be changed by contacting our Support team. In the future, this will be a configurable parameter under Settings.

How JangoSMTP sets the MAIL-FROM address

By default, the MAIL-FROM address is your JangoSMTP account username followed by So if your username is "browniekichen" your default MAIL-FROM address is

Even if you set your actual From Address on your transactional email to, the MAIL-FROM will be It is set this way to ensure SPF/SenderID compliance and to allow for automated bounce processing.

However, JangoSMTP does allow you to override the default and take control the MAIL-FROM address. There are two methods to accomplish this, and they are both explained in step 1 of the post on optimizing transactional email deliverability.

Both methods provide for better deliverability than the default option.


Wikipedia's list of email-to-SMS gateways
Wikipedia article on the MAIL-FROM address
JangoSMTP Support