0

edit: It appears that many people are having this problem.

I am using the Pony email gem to send SMS' to phone numbers in a Ruby on Rails app. It is hosted on Heroku. When sent from Pony, it works on AT&T and Verizon, but not on T-Mobile. But, when I send the email from the Gmail web interface the SMS is delivered to the T-Mobile number.

I'm thinking some of the email headers are causing T-Mobile to reject the email. Here is the email sent from Gmail (private information obscured):

MIME-Version: 1.0
Received: by 55.55.55.55 with HTTP; Mon, 2 Mar 2015 23:51:51 -0800 (PST)
Date: Mon, 2 Mar 2015 23:51:51 -0800
Delivered-To: valid.from.email@gmail.com
Message-ID: <CAN-5ELre3XqXgZQ-6_QGz7C=YXpAoZuTXPODHSmnZ=EOXA0Xwg@mail.gmail.com>
Subject: 
From: From Name <valid.from.email@gmail.com>
To: valid.10.digit.phone.number@tmomail.net
Content-Type: text/plain; charset=UTF-8

email content

This is the email sent from Pony. I know this email is being sent because it shows up under Sent in the Gmail web interface.

Return-Path: <valid.from.email@gmail.com>
Received: from localhost.localdomain (ec2-55-555-55-555.compute-1.amazonaws.com. [55.555.55.555])
        by mx.google.com with ESMTPSA id g29sm577452ioi.35.2015.03.02.23.50.57
        for <valid.10.digit.phone.number@tmomail.net>
        (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Mon, 02 Mar 2015 23:50:57 -0800 (PST)
Date: Tue, 03 Mar 2015 07:50:56 +0000
From: Frome Name <valid.from.email@gmail.com>
To: valid.10.digit.phone.number@tmomail.net
Message-ID: <54f567e08593f_33ff884d99e98497cf@d599820b-b537-4e60-bc52-671c771bf43c.mail>
Mime-Version: 1.0
Content-Type: text/plain;
 charset=UTF-8
Content-Transfer-Encoding: 7bit
Delivered-To: valid.from.email@gmail.com

Pony Message content

This is the code that I'm using to send the email.

Pony.mail({
  :to => 'valid.10.digit.phone.number@tmomail.net',
  :body => 'Test Pony',
  :headers => { "Delivered-To" => "valid.from.email@gmail.com", 'Content-Type' => 'text/html' },
  :subject => 'Subject',
  :from => 'From Name <valid.from.email@gmail.com>',
  :via => :smtp,
  :via_options => {
    :address              => 'smtp.gmail.com',
    :port                 => '587',
    :enable_starttls_auto => true,
    :user_name            => 'valid.from.email@gmail.com',
    :password             => ENV['EMAIL_PASSWORD'],
    :authentication       => :plain, # :plain, :login, :cram_md5, no auth by default
  }
})

The headers that I suspect could be causing the problems are the Received, Content-Type (there is a line break on the Pony email), and Content-Transfer-Encoding headers. I couldn't figure out how to change any of those values in Pony.

SamB
  • 2,621
  • 4
  • 34
  • 39
  • How many email are you sending? I've noticed that the Email->SMS gateways aggressively block senders after fairly low volume. – rdegges Mar 06 '15 at 17:18
  • 1
    It didn't work the first time, and has never worked :( I decided to just use Twilio for T-Mobile. – SamB Mar 07 '15 at 00:54

0 Answers0