PDA

View Full Version : Email to SMS gateway (numbers pulled from db) not working with T-mobile


Fallenhero
05-08-2009, 12:24 AM
For work I developed a simple text alert system in asp/vbscript where people sign up (selecting their carrier) and then we send them alerts from time to time.


On the backend their numbers are stored in an access database. When we send out our alert, we grab 5 numbers, send out the alert and then loop (continually sending out messages in bursts of 5 numbers) until all of the numbers have had the message sent to them.

This works perfectly with every other main carrier except T-mobile. Does anyone have an idea why?


Note: our current database has 300 numbers (different carriers are mixed within). When we initially tried on a smaller scale (using a sample of 10-15) most of the time T-mobile worked, however it didn't work at all when all of the numbers were used. I would guess that out of the 300 numbers, about 30 of them are t-mobile customers.

bazz
05-08-2009, 01:16 AM
Have you tested your script by trying to send only to T-mobile numbers? Does that work?

just a thoguht that might help to narow down the issue. To help further I think we need to see some code.

bazz

Fallenhero
05-08-2009, 01:34 AM
Yes, I did try T-mobile only, but was only able to confirm with 3 people (who I know personally) 2/3 received it. Thanks so much for your help!

Below is the code:


<%
Dim adoCon, employee_addy, strSQL
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ="& Server.MapPath(".") & "/../addresses_text.mdb"

Set employee_addy = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT employee_addy.* FROM employee_addy ORDER by email_address ASC;"
employee_addy.Open strSQL, adoCon


//Get count for e-mail bursts
Dim CountRS
set CountRS = server.CreateObject("adodb.recordset")
CountRS.open "select count(*) as total_count from employee_addy", adoCon
Dim TotalNumbers
TotalNumbers=CountRS("total_count")
CountRS.close
set CountRS=nothing



Dim MyNumber, i,j, test

TotalNumbers=int(TotalNumbers)


//Loop algorithm to send bursts of 5 emails at a time
For i=1 to TotalNumbers


//Create e-mail message
Set SMTPeil = CreateObject("EasyMail.SMTP.5")
SMTPeil.MailServer = "removed for company privacy"

for j=1 to 5

MyNumber=Trim(employee_addy("email_address"))
SMTPeil.AddRecipient "employee", MyNumber, 1

if i=TotalNumbers then
j=5
else
i=i+1
employee_addy.MoveNext
end if

next
if i<>TotalNumbers then
i=i-1
end if

SMTPeil.LicenseKey = "removed for privacy"
SMTPeil.Subject= ""
SMTPeil.BodyText = BodyTxt
SMTPeil.From = ""
SMTPeil.FromAddr = "emailalert@emailalert.com" rsEIL = SMTPeil.Send
Set SMTPeil = nothing

Next

employee_addy.Close
Set employee_addy = Nothing
Set adoCon = Nothing
%>

Old Pedant
05-08-2009, 02:47 AM
As I recall, you can send to T-Mobile (and Sprint and Verizon) customers by just using their phone number @ a particular URL.

For example, you can send to Verizon by just using
8885551212@VText.com

*IF* you could ask your customers which server they are using, you could bypass this SMS service that is perhaps unreliable?? May not work for all carriers, but

Yes...just looked it up:
8885551212]@tmomail.net

Fallenhero
05-08-2009, 03:02 AM
Unfortunately that is how I am doing it. When they sign up they enter their phone number and select their carrier from a drop down. On the back back end it puts them together and stores it in the database.

For example: Like you mentioned the t-mobile number would be stored as
8885551212@tmomail.net

When it is sent to the carrier, the carrier then converts it to a sms text message and routes it to the persons phone.

Old Pedant
05-08-2009, 03:42 AM
Oh...sorry...thought you were using one of those SMS proxy services, where you don't have to know the carrier.

Have you tried sending the messages one at a time? Possibly tmobile is choking on seeing the multiple addresses??

Fallenhero
05-08-2009, 07:32 PM
I have a test form that they can use to verify their phone can receive the text (it's not required to test first, however it seems like almost everyone does based on the e-mail that gets copied to me). Once they have verified they sign up.

From what I know this has always worked. The only other variable that is involved besides sending a single message as to multiple looped messages is that their number information is coming directly from the form in the test where as it is with the mass message it is being pulled from the database and being stored in a variable.....this is issue is making me pull my hair out! lol

bazz
05-08-2009, 11:14 PM
You should post the script. If you are not getting the correct value into the variable, it would at least go some way to explain its irregularities.

bazz

Fallenhero
05-08-2009, 11:26 PM
Good idea! Here is the script for the test alert as well as the mass alert. Let me know if you have any ideas.

Test script (always works with T-mobile):
<%
Dim BodyTxt, Phone, Carrier
BodyTxt = BodyTxt & "Success! You have confirmed your mobile device will receive texts from the text alert feature."

//Create address
Phone=request.form("Phone")
Carrier=request.Form("Carrier")
Carrier=Phone&"@"&Carrier

Set SMTPeil = CreateObject("EasyMail.SMTP.5")
SMTPeil.MailServer = "removed for privacy"
SMTPeil.AddRecipient "employee", Carrier , 1
SMTPeil.LicenseKey = "removed for privacy"
SMTPeil.Subject= ""
SMTPeil.BodyText = BodyTxt
SMTPeil.From = ""
SMTPeil.FromAddr = "emailalert@emailalert.com"
rsEIL = SMTPeil.Send
Set SMTPeil = nothing
%>

Mass e-mail script (Only seemed to work with T-mobile when using a small amount of test numbers):
<%
Dim adoCon, employee_addy, strSQL
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ="& Server.MapPath(".") & "/../addresses_text.mdb"

Set employee_addy = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT employee_addy.* FROM employee_addy ORDER by email_address ASC;"
employee_addy.Open strSQL, adoCon


//Get count for e-mail bursts
Dim CountRS
set CountRS = server.CreateObject("adodb.recordset")
CountRS.open "select count(*) as total_count from employee_addy", adoCon
Dim TotalNumbers
TotalNumbers=CountRS("total_count")
CountRS.close
set CountRS=nothing

Dim MyNumber, i,j, test

TotalNumbers=int(TotalNumbers)

//Loop algorithm to send bursts of 5 emails at a time
For i=1 to TotalNumbers

//Create e-mail message
Set SMTPeil = CreateObject("EasyMail.SMTP.5")
SMTPeil.MailServer = "removed for company privacy"

for j=1 to 5

MyNumber=Trim(employee_addy("email_address"))
SMTPeil.AddRecipient "employee", MyNumber, 1

if i=TotalNumbers then
j=5
else
i=i+1
employee_addy.MoveNext
end if

next
if i<>TotalNumbers then
i=i-1
end if

SMTPeil.LicenseKey = "removed for privacy"
SMTPeil.Subject= ""
SMTPeil.BodyText = BodyTxt
SMTPeil.From = ""
SMTPeil.FromAddr = "emailalert@emailalert.com"
rsEIL = SMTPeil.Send
Set SMTPeil = nothing

Next

employee_addy.Close
Set employee_addy = Nothing
Set adoCon = Nothing
%>

bazz
05-08-2009, 11:37 PM
Just read your highlights in that last post. There is another test you could perform.

If you send a burst of messages and some do not go through try to send a burst to just those addresses. Is it always the same one which do not go through?

I am not au fait with ASP. I know when using perl it is very unforgiving. It may make a difference if your email addresses coming from the db are checked against how they come in from the form. Have any of those email addrss (from the db) got an 'invisible' space after them? That has caught me out a few times before in search scenarios..

hth

bazz

Fallenhero
05-08-2009, 11:49 PM
It seems like it's only affect T-mobile numbers when sent in bursts. The way it is set up it takes the first 5 numbers and sends then the next 5. It doesn't sort by carrier. So one message could have any mixture of carrier numbers (e.g. 1-Tmobile, 2-ATT, 2- Verizon).

Do you think it's possible that T-mobile is seeing the bursts from the same address and filtering it out like it's SPAM?

I thought about the invisible space thing because that has tripped me up before to, so I added:
MyNumber=Trim(employee_addy("email_address"))
That should remove any spaces before or after, however the issue still exists. :(

Old Pedant
05-09-2009, 09:03 PM
Do you think it's possible that T-mobile is seeing the bursts from the same address and filtering it out like it's SPAM?

Might even be in their "terms and condtions", that you can't send to multiple addresses?

Who knows.

Go back to sending one at a time. You only have a few hundred; it should make a big difference.