Question

I am writing a Ruby on Rails app using Mandrill to send email to text.

My texts are working fine for AT&T, T-Mobile, and Sprint. But my texts to Verizon are being cut off. I've read that Verizon has a character limit of 160 characters, but my texts are being cut off earlier than that, around 80 characters.

Does anyone have any idea why this might be?

I am sending just plain text emails.

Edit - Code per request

Mailer:

class Texter < ActionMailer::Base
 default from: "texts@domain.com"

 def test(number, content)
    @content = content
    mail(:to => number)
 end
end

View (test.text.erb)

<%= @content %>
Was it helpful?

Solution 2

Instead of using the ##########@vtext.com address for Verizon users, use the alternate ##########@vzwpix.com which allows for Verizon customers to receive longer MMS messages or messages that contain pictures and video.

I was finding messages sent to the vtext.com address were being truncated at 150 characters (actual truncation appears to vary depending on the number of characters in the email address or if the message contains a subject line, etc.) Additional messages were not automatically generated with the remainder of the original message, they were simply truncated.

Sending to the vzwpix.com address I was able to receive the full length of the message, far exceeding a 150-160 character limit.

OTHER TIPS

The character limitation is actually caused simply by the fact that the SMS protocol defines a maximum payload size of 1120 bits.

In matter of characters, length varies according to encoding.

  • 7-bit = 160 characters
  • 8-bit = 140 characters
  • 16-bit = 70 characters

Additionally some providers include From and/or Subject fields in the message content which additionally decreases the number of available space you can use for your message.

You state that the emails to SMS work for other providers such as AT&T, T-Mobile and Sprint. Your email content is probably ok, but to verify that hypothesis, try sending an email manually to the Verizon email-to-sms gateway.

From there you'll either find out it's the content of your email or the gateway itself is the problem. Hopefully you'll get a response from the gateway with some sort of diagnostic, if there is a problem.

Another option I'd recommend is the sms-fu gem [1]. As a bonus, it supports more providers than the 4 you mentioned.

Good luck!

[1] https://github.com/brendanlim/sms-fu

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top