Send a Text Message to a Smartphone via EMail
December 2016

One of the applications I developed needed to send a temporary password to a client when they had forgotten their password. After doing some research I found that I could use email to send the temporary password. I found some code at:

I developed a VB.Net, Asp.Net, Visual Studio 2008 application that demonstrates the process. Click here to run the app.

The Demo App

The app asks for the Smartphone number and the carrier servicing the phone. I found a large list of carriers and added them to the dropdown box. Found at

A Partial List of Carriers

Carrier Lookup

If the user clicks the 'Carrier Lookup' link it launches a web site that will return the carrier associated with the entered phone number. In this case we would use for number 415-567-8900.

The Significant VB.Net Source Code

I created a Gmail account to test the app. The account's Username, Password and Server Host values are show in the source code. You will want to substitute your email account values.

The Significant VB.Net Source Code
Private Function DoSend(ByVal sPhoneTo As String, ByVal sCarrier As String, _
          ByVal sSubject As String, ByVal sMessage As String) As Boolean

' 2016/11/27 Function added by Larry Rebich using the HP-IQ804 while in Indio, CA
' 2016/11/29 Inspiration:

' 2016/11/29 A test email account was setup at GMail
' Change these to point to your email account and server host

Dim sUserName As String = ""
Dim sPassword As String = "TipOfTheMonth"
Dim sServerHost As String =

Smtp_Server As New SmtpClient
Dim e_mail As New MailMessage()
Smtp_Server.UseDefaultCredentials =
Smtp_Server.Credentials = New Net.NetworkCredential(sUserName, sPassword)
Smtp_Server.Port = 587
Smtp_Server.EnableSsl =
Smtp_Server.Host = sServerHost
e_mail =
New MailMessage()
e_mail.From =
New MailAddress(sUserName)
e_mail.To.Add(sPhoneTo & sCarrier)
e_mail.Subject = sSubject
e_mail.IsBodyHtml =
e_mail.Body = sMessage
'send it



End Function

Message sent successfully.

Error: No Phone Number Entered

Error: No Carrier Selected

Download VB.Net Code

Click here to download the VS2008 VB.Net source code [376k].

Previous Tip   Tip Index   Next Tip


Updated 2018/10/08