Click here to Skip to main content
11,484,640 members (60,019 online)
Click here to Skip to main content

Email and SMS Sending Through VB.NET for Free

, 17 Nov 2009 CPOL 109.4K 30.3K 53
Rate this:
Please Sign up or sign in to vote.
Send free SMS from your VB.NET application

Introduction

This VB.NET code sends Email and SMS for free with the help of your Gmail ID. One main advantage of this is that you can send SMS for free because most webservices are not free to use with your application.

Using the Code

I used Gmail as my SMTP server and Mytoday to support free SMS Service here in this code. Since this code uses Gmail SMTP server, you need a Gmail account to send Email. Actually SMS from the application is sent from the Email. You can send SMS only to particular numbers in India. When you register your phone number in the website http://email2sms.netcore.co.in/, an Email ID will be given for the phone number which you register, so that when you mail to that id the message will be received as SMS in the particular number. Suppose the phone number is 9897345890 the mail id given from that website will be like this 9897345890@m3m.in. It works only for Indian numbers.

To run this application successfully, two things should be done:

  1. You must have Gmail ID.
  2. Register the phone number which you are going to use in a website http://email2sms.netcore.co.in/.
Private Sub Button1_Click(ByVal sender As System.Object, _
	ByVal e As System.EventArgs) Handles Button1.Click

Dim smtpServer As New SmtpClient()
Dim mail As New MailMessage
smtpServer.Credentials = New Net.NetworkCredential_
	(TextBox1.Text & "@gmail.com", TextBox2.Text)
smtpServer.Port = 587
smtpServer.Host = "smtp.gmail.com"
smtpServer.EnableSsl = True
mail.From = New MailAddress(TextBox1.Text & "@gmail.com")
If RadioButton1.Checked = True Then
mail.To.Add("91" & TextBox3.Text & "@m3m.in")
ElseIf RadioButton2.Checked = True Then
mail.To.Add(TextBox3.Text)
End If
mail.Subject = TextBox4.Text
mail.Body = TextBox5.Text()
smtpServer.Send(mail)
MsgBox("mail is sent", MsgBoxStyle.OkOnly, "Report")
End Sub

Hope this code will be helpful...

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

balaji2525

India India
No Biography provided

Comments and Discussions

 
QuestionVery nice and informative article for me. Pin
nevil_11927-Aug-14 0:25
membernevil_11927-Aug-14 0:25 
QuestionErrors in my code Pin
Member 1094591117-Jul-14 2:27
memberMember 1094591117-Jul-14 2:27 
Questionkaushik Pin
Member 1076934031-May-14 0:52
memberMember 1076934031-May-14 0:52 
Question"Failure sending mail." Pin
satyanvm14-Apr-14 20:57
membersatyanvm14-Apr-14 20:57 
Questionsms not working Pin
jaykantjha20-Mar-14 1:54
professionaljaykantjha20-Mar-14 1:54 
Bughaving error "server required secure connection" Pin
mbdali9-Feb-14 23:19
membermbdali9-Feb-14 23:19 
Questionquestions from sms sending please answer :) Pin
Member 104520595-Jan-14 1:56
memberMember 104520595-Jan-14 1:56 
QuestionI need help Pin
Member 1046792115-Dec-13 8:10
memberMember 1046792115-Dec-13 8:10 
Questionexception [modified] Pin
Balakrishnan B23-Mar-13 5:26
memberBalakrishnan B23-Mar-13 5:26 
QuestionHelp!! Pin
Gopal Krishna Mailapalli13-Jan-13 0:17
memberGopal Krishna Mailapalli13-Jan-13 0:17 
QuestionHow can we use this code for srilankan customers....please urgent Pin
Member 434691614-Nov-12 23:11
memberMember 434691614-Nov-12 23:11 
QuestionSending SMS using vb.net Pin
Rakesh A Rao1-Oct-12 22:22
memberRakesh A Rao1-Oct-12 22:22 
QuestionREG:project Pin
mohanjack13-Sep-12 21:49
membermohanjack13-Sep-12 21:49 
sir:-
i can.t send sms please tell me instruction sir Smile | :) Smile | :) Smile | :) Smile | :) Smile | :) Smile | :)
AnswerRe: REG:project Pin
balaji252513-Sep-12 21:53
memberbalaji252513-Sep-12 21:53 
Questionquestion Pin
sarode_sanket29-Jul-12 21:05
membersarode_sanket29-Jul-12 21:05 
AnswerRe: question Pin
balaji252529-Jul-12 22:38
memberbalaji252529-Jul-12 22:38 
GeneralRe: question Pin
fanta hubert28-Jan-14 22:18
memberfanta hubert28-Jan-14 22:18 
QuestionThis is not working Please send me the code using visual studio 2008 for my mail soon Pin
yuganthi16-Jul-12 8:18
memberyuganthi16-Jul-12 8:18 
AnswerRe: This is not working Please send me the code using visual studio 2008 for my mail soon Pin
balaji252516-Jul-12 20:21
memberbalaji252516-Jul-12 20:21 
GeneralRe: This is not working Please send me the code using visual studio 2008 for my mail soon Pin
yuganthi16-Jul-12 23:46
memberyuganthi16-Jul-12 23:46 
GeneralPlease help me the programming of my program SMS amd Mail Pin
jaber-omar16-Apr-12 2:35
memberjaber-omar16-Apr-12 2:35 
Questionsending email failed Pin
Member 769909024-Sep-11 7:14
memberMember 769909024-Sep-11 7:14 
GeneralAny idea of sending sms without using the 3rd part (m3m) registration. Pin
DineshSIS23-Aug-10 0:15
memberDineshSIS23-Aug-10 0:15 
GeneralRe: Any idea of sending sms without using the 3rd part (m3m) registration. Pin
balaji252525-Aug-10 16:56
memberbalaji252525-Aug-10 16:56 
GeneralRe: Any idea of sending sms without using the 3rd part (m3m) registration. Pin
balaji252525-Aug-10 17:03
memberbalaji252525-Aug-10 17:03 
Questionwhat about israel ? Pin
BEDEK336-Mar-10 4:37
memberBEDEK336-Mar-10 4:37 
GeneralMy vote of 2 Pin
Vamsi Pulavarthi15-Dec-09 6:44
memberVamsi Pulavarthi15-Dec-09 6:44 
GeneralMy vote of 1 Pin
Ashfield18-Nov-09 6:19
mvpAshfield18-Nov-09 6:19 
GeneralRe: My vote of 1 Pin
Member 104520595-Jan-14 2:06
memberMember 104520595-Jan-14 2:06 
Generalcalculator in vb Pin
sura94516-Nov-09 2:53
membersura94516-Nov-09 2:53 
GeneralRe: calculator in vb Pin
balaji252517-Nov-09 8:12
memberbalaji252517-Nov-09 8:12 
GeneralMy vote of 1 Pin
GriffinPeter13-Nov-09 9:21
memberGriffinPeter13-Nov-09 9:21 
GeneralRe: My vote of 1 Pin
balaji252517-Nov-09 8:03
memberbalaji252517-Nov-09 8:03 
GeneralRe: My vote of 1 Pin
balaji252517-Nov-09 8:06
memberbalaji252517-Nov-09 8:06 
Generalpls help Pin
mhn2179-Nov-09 1:25
membermhn2179-Nov-09 1:25 
GeneralRe: pls help Pin
GriffinPeter13-Nov-09 9:21
memberGriffinPeter13-Nov-09 9:21 
GeneralMy vote of 1 Pin
Dennis Micheelsen8-Nov-09 21:10
memberDennis Micheelsen8-Nov-09 21:10 
GeneralMy vote of 1 Pin
kalyankrishna18-Nov-09 7:30
memberkalyankrishna18-Nov-09 7:30 
GeneralRe: My vote of 1 Pin
balaji252517-Nov-09 8:08
memberbalaji252517-Nov-09 8:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150520.1 | Last Updated 17 Nov 2009
Article Copyright 2009 by balaji2525
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid