954,551 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

sending sms using vb.net

hi, im new to vb.net and recently i am doing a web application on sending sms. anyone has got any codes for sending sms using vb.net?

or does anyone know where i can get relevant info for it.

ruisi
Newbie Poster
1 post since Aug 2004
Reputation Points: 10
Solved Threads: 0
 

yeah i also need someidea about that

dmohanty
Newbie Poster
13 posts since Sep 2004
Reputation Points: 10
Solved Threads: 0
 

hi, im new to vb.net and recently i am doing a web application on sending sms. anyone has got any codes for sending sms using vb.net?

or does anyone know where i can get relevant info for it.

Hi there
i have read ur question and u vl b surprised that instead of sending any solutions i m asking u the same question. i m also trying for the same thing as u r doing. what i have done is that i have developed a mail server and the person having registration in our mail server can mail each other. Now when any person is getting mail and if he is having a mobile then he will instantly get reported abt the mail. So plz do help me if u have find any code.
My email id is [email]tailor_alpa@yahoo.com[/email]
Hoping and waiting for ur reply
Alpa tailor

Alpa tailor
Newbie Poster
1 post since Sep 2004
Reputation Points: 10
Solved Threads: 0
 

hi both, i am now doing a project of sending sms using vb.net, but i have no idea of how to start, and do both of u have any code of that. and what type of gateway are you both using? thanks a millions. It is urgent. and my contact is [email]april_er@msn.com[/email]. pls contact me thanks

april_er
Newbie Poster
16 posts since Feb 2005
Reputation Points: 10
Solved Threads: 0
 

Hi surprisely, so many people is lookign for the codes to sending sms in vb...Im also looking hard for it..=( I need the codes in vb.net...Any kind soul can help out us?? thanks alot man!!

Cheers...Happy chinese year in advance....

miaoqing
Newbie Poster
1 post since Feb 2005
Reputation Points: 10
Solved Threads: 0
 

may i know what type of sms gateway u are using?

april_er
Newbie Poster
16 posts since Feb 2005
Reputation Points: 10
Solved Threads: 0
 

Hai guys ..Topic sounds interesting .....I wanna try that to......Can anybody give an explanation on how to achieve that...

Letscode
Junior Poster
175 posts since Feb 2005
Reputation Points: 11
Solved Threads: 6
 

In VB? you gotta be kidding!

OriDjinn
Newbie Poster
2 posts since Feb 2005
Reputation Points: 10
Solved Threads: 0
 

To send SMS to mobile phone you cannot simply do it with "your own Code",
because SMS it's a resource inside the mobile network and the only way to
access it is by the means provided by the mobile operators (the network
owners).
most of them provide access trough web services, because it's a clean and
standard way that works throughout all platforms.
If you want "some other way" you can talk directly to the mobile operators
and ask them to provide you with SMPP access to the server, so you can send
messages from you code using SMPP instead of web services.

Letscode
Junior Poster
175 posts since Feb 2005
Reputation Points: 11
Solved Threads: 6
 

As posted by Letscode, you will have to use the SMPP server of the celular service provider. Depending on the country and the provider, it may be from easy to imposible to have them give you access to it. They may require a VPN connection to the computer making it happen. If you are going to use SMPP, you will need WinSock to create the connection and you will have to visit http://www.smsforum.net to learn SMPP. There yet is another way to do it. Read my next reply.

AhCacao
Newbie Poster
4 posts since May 2005
Reputation Points: 10
Solved Threads: 0
 

The other way, is by using a GSM modem. Brands are WaveCom Fastrack, Multitech and SonyEricson. The latest, called GM28 and distributed by www.toppcompanies.com is the one I found most reliable (I´ve tested the others).
If you go for a modem, you will have to use MSCOMM to communicate with the modem via Serial Port. The connection parameters will vary with each model. Then you will have to transmit AT commands to the modems to have them send and receive SMS.
To help you decide which method to use, read the next reply...

AhCacao
Newbie Poster
4 posts since May 2005
Reputation Points: 10
Solved Threads: 0
 

The SMPP option gives you these advantages and disadvantages:
- Massive amounts of SMS. Perfect for SMS spammers.
- Lower costs, depending whether your provider charges you for SMPP and how much.
- Providers rarely release access to SMPP to individuals. Sometimes not even companies.
The GSM Modem option gives you these other advantages:
- Freedom from the provider. Just insert the SIM and you are ready.
- It will handle (outgoing or incoming) only 1 message every 4.5 seconds.

Sample code... sorry is too much. But will gladly gide you to the pieces of the puzzle.

AhCacao
Newbie Poster
4 posts since May 2005
Reputation Points: 10
Solved Threads: 0
 

Oh.. and before I forget, there is also the posibility of ONLY Sending messages, by using PHP via HTTP. I know there is a way create your own internet explorer with vb, which I have not done yet. Therefore, all you need is to send the appropiate code to the URL provided by the carrier. For this, you will need to find out if your carrier allows SMS via HTTP, and if they will give you access to it. I have the PHP protocol needed for this somewhere. I´ll post it here later.

AhCacao
Newbie Poster
4 posts since May 2005
Reputation Points: 10
Solved Threads: 0
 

Well i can say i have done smething of this kind in VB before.U better go thru Hayes Commands which are used for sending and recieving SMS.

vrushalinz1
Newbie Poster
9 posts since Jun 2005
Reputation Points: 10
Solved Threads: 0
 

hye guys
Thers an easy way to send sms from ur .NET application
all u need is a web service that provides this,
well most of them are not for free, although u can use trial licences that let u send around 5 - 10 sms's for free
u can try out Stike Iron ( 10 sms free for trial licence)

http://ws.strikeiron.com/SMSTextMessaging?WSDL

just add the web reference to this wsdl from ur VS and thats as easy as it gets

Happy sms 'ing

PS: i have a sample application if anyone wants mail me:dharshan.ks@gmail.com

Cheers

dharshan
Newbie Poster
1 post since Jul 2005
Reputation Points: 10
Solved Threads: 0
 

Below is simple code:

Imports System.Web.Mail
.
.
.
Dim toPhoneNumber As String = "DestinationPhoneNumber";
Dim login As String = "YouredomainUsername"
Dim password As String = "YourPassword"
Dim compression As String = "Compression Option goes here "
Dim body As String = "Your Message"
Dim mail As System.Web.Mail.MailMessage = New System.Web.Mail.MailMessage

mail.To = toPhoneNumber + "@sms.domainname.com"
mail.From = login + "@domain.com"
mail.Subject = compression
mail.Body = body
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1")
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", login)
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", password)


System.Web.Mail.SmtpMail.SmtpServer = "domain.com";
System.Web.Mail.SmtpMail.Send(mail)

or u can find out on this link below:
http://www.ipipi.com/help/send_text_message_using_vb_net.htm

NetDev
Newbie Poster
2 posts since Dec 2005
Reputation Points: 10
Solved Threads: 0
 

You can go to

http://www.emant.com/681002.page

where there is the free sms component emantsms and an example program.

2cworth
Newbie Poster
1 post since Feb 2006
Reputation Points: 10
Solved Threads: 0
 

There is one way to send for free without using an sms gateway but you have to know the carrier the person is on. You can then send an email. Most are in the form of [email]mobilenumber@carrierssmsemail.tld[/email] For example verizon is [email]mobilenumber@vtext.com[/email] and most major carriers have similar.

f1 fan
Posting Whiz in Training
279 posts since Jan 2006
Reputation Points: 26
Solved Threads: 11
 

HI,
Here is code for a dll file for VB.NET 2005 that I am currently using to send SMS Messages. Receiving SMS Messages are not done yet, but I will post it when it is done. This Code will work with FARGO Maestro 100 GSM Modem (WAVECOM)

Please note that this code use threading ...

Option Explicit On
Imports System
Imports System.Threading
Imports System.ComponentModel
Imports System.Windows.Forms
Imports System.IO.Ports
 
 
 
PublicClass SMSCOMMS
Private WithEvents SMSPort As SerialPort
Private SMSThread As Thread
Private ReadThread As Thread
Shared _Continue As Boolean = False
Shared _ContSMS As Boolean = False
Private _Wait As Boolean = False
Shared _ReadPort As Boolean = False
Private WithEvents DBServer As Postgres
Public Event Sending(ByVal Done As Boolean)
Public Event DataReceived(ByVal Message As String)
 
Public Sub New(ByRef COMMPORT As String)
SMSPort = New SerialPort
With SMSPort
.PortName = COMMPORT
.BaudRate = 9600
.Parity = Parity.None
.DataBits = 8
.StopBits = StopBits.One
.Handshake = Handshake.RequestToSend
.DtrEnable = True
.RtsEnable = True
.NewLine = vbCrLf
End With
DBServer = New Postgres()
ReadThread = New Thread(AddressOf ReadPort)
End Sub
 
Public Function SendSMS(ByVal CellNumber As String, ByVal SMSMessage As String) As Boolean
Dim MyMessage As String = Nothing
'
'Check if Message Length <= 160
If SMSMessage.Length <= 160 Then
MyMessage = SMSMessage
Else
MyMessage = Mid(SMSMessage, 1, 160)
End If
'MsgBox("Sending " & MyMessage & " to " & CellNumber)
If IsOpen = True Then
SMSPort.WriteLine("AT+CMGS=" & CellNumber & vbCr)
_ContSMS = False
While _ContSMS = False
Application.DoEvents()
End While
SMSPort.WriteLine(MyMessage & vbCrLf & Chr(26))
_Continue = False
RaiseEvent Sending(False)
End If
End Function
 
 
Private Sub ReadPort()
Dim SerialIn As String = Nothing
Dim RXBuffer(SMSPort.ReadBufferSize) As Byte
Dim SMSMessage As String = Nothing
Dim Strpos As Integer = 0
Dim TmpStr As String = Nothing
While SMSPort.IsOpen = True
If (SMSPort.BytesToRead <> 0) And (SMSPort.IsOpen = True) Then
While SMSPort.BytesToRead <> 0
SMSPort.Read(RXBuffer, 0, SMSPort.ReadBufferSize) 'SMSPort.BytesToRead
SerialIn = SerialIn & System.Text.Encoding.ASCII.GetString(RXBuffer)
' Handle Internal Events
' For Received Characters
If SerialIn.Contains(">") = True Then
_ContSMS = True
End If
If SerialIn.Contains("+CMGS:") = True Then
_Continue = True
RaiseEvent Sending(True)
_Wait = False
SerialIn = String.Empty
ReDim RXBuffer(SMSPort.ReadBufferSize)
End If
 
End While
RaiseEvent DataReceived(SerialIn)
SerialIn = String.Empty
ReDim RXBuffer(SMSPort.ReadBufferSize)
End If
End While
End Sub
 
 
Public ReadOnly Property IsOpen() As Boolean
Get
If SMSPort.IsOpen = True Then
IsOpen = True
Else
IsOpen = False
End If
End Get
End Property
 
Public Sub Open()
If IsOpen = False Then
SMSPort.Open()
ReadThread.Start()
End If
End Sub
 
Public Sub Close()
If IsOpen = True Then
SMSPort.Close()
End If
End Sub
 
 
 
 
EndClass


Usage Of The Above Code Should be straight Forward, But Here Goes

In a Windows Form App

Option Explicit On
 
'Other Imports
Imports SMSCOMMS
' Rest of stuff
 
'Declarations
Public WitheEvents SMSEngine as SMSCOMMS
 
Public Sub Main()
   SMSEngine = New SMSCOMMS("COM1")
    SMSEngine.Open()
    SMSEngine.SendSMS("000000000","THIS IS YOUR MESSAGE")
End Sub
 
Public Sub Form_Close()
 SMSEngine.Close()
End Sub


I Hope this helps :)

Jeanred
Newbie Poster
2 posts since Sep 2006
Reputation Points: 13
Solved Threads: 0
 

I found a link to a page showing how to send text messages in .NET. Its in C# instead of VB.NET, but it should still help. Plus, the web service being used, webservicex, is a free unlimited service, so that should definitely be worth taking a look at if you need a free SMS web service.

Here's the link:

http://www.codeproject.com/cs/webservices/SendSmsThroughWS.asp

Hope this helps!

Jeff

jeffmoretti
Newbie Poster
1 post since Oct 2006
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You