Click here to Skip to main content
Click here to Skip to main content

Email and SMS Sending Through VB.NET for Free

, 17 Nov 2009 CPOL
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. Pinmembernevil_11926-Aug-14 23:25 
QuestionErrors in my code PinmemberMember 1094591117-Jul-14 1:27 
Questionkaushik PinmemberMember 1076934030-May-14 23:52 
Question"Failure sending mail." Pinmembersatyanvm14-Apr-14 19:57 
Questionsms not working Pinprofessionaljaykantjha20-Mar-14 0:54 
Bughaving error "server required secure connection" Pinmembermbdali9-Feb-14 22:19 
Questionquestions from sms sending please answer :) PinmemberMember 104520595-Jan-14 0:56 
QuestionI need help PinmemberMember 1046792115-Dec-13 7:10 
Questionexception [modified] PinmemberBalakrishnan B23-Mar-13 4:26 
QuestionHelp!! PinmemberGopal Krishna Mailapalli12-Jan-13 23:17 
QuestionHow can we use this code for srilankan customers....please urgent PinmemberMember 434691614-Nov-12 22:11 
QuestionSending SMS using vb.net PinmemberRakesh A Rao1-Oct-12 21:22 
QuestionREG:project Pinmembermohanjack13-Sep-12 20:49 
AnswerRe: REG:project Pinmemberbalaji252513-Sep-12 20:53 
Questionquestion Pinmembersarode_sanket29-Jul-12 20:05 
AnswerRe: question Pinmemberbalaji252529-Jul-12 21:38 
GeneralRe: question Pinmemberfanta hubert28-Jan-14 21:18 
QuestionThis is not working Please send me the code using visual studio 2008 for my mail soon Pinmemberyuganthi16-Jul-12 7:18 
AnswerRe: This is not working Please send me the code using visual studio 2008 for my mail soon Pinmemberbalaji252516-Jul-12 19:21 
GeneralRe: This is not working Please send me the code using visual studio 2008 for my mail soon Pinmemberyuganthi16-Jul-12 22:46 
GeneralPlease help me the programming of my program SMS amd Mail Pinmemberjaber-omar16-Apr-12 1:35 
Questionsending email failed PinmemberMember 769909024-Sep-11 6:14 
GeneralAny idea of sending sms without using the 3rd part (m3m) registration. PinmemberDineshSIS22-Aug-10 23:15 
GeneralRe: Any idea of sending sms without using the 3rd part (m3m) registration. Pinmemberbalaji252525-Aug-10 15:56 
GeneralRe: Any idea of sending sms without using the 3rd part (m3m) registration. Pinmemberbalaji252525-Aug-10 16:03 
Questionwhat about israel ? PinmemberBEDEK336-Mar-10 3:37 
GeneralMy vote of 2 PinmemberVamsi Pulavarthi15-Dec-09 5:44 
GeneralMy vote of 1 PinmvpAshfield18-Nov-09 5:19 
GeneralRe: My vote of 1 PinmemberMember 104520595-Jan-14 1:06 
Generalcalculator in vb Pinmembersura94516-Nov-09 1:53 
GeneralRe: calculator in vb Pinmemberbalaji252517-Nov-09 7:12 
GeneralMy vote of 1 PinmemberGriffinPeter13-Nov-09 8:21 
GeneralRe: My vote of 1 Pinmemberbalaji252517-Nov-09 7:03 
GeneralRe: My vote of 1 Pinmemberbalaji252517-Nov-09 7:06 
Generalpls help Pinmembermhn2179-Nov-09 0:25 
GeneralRe: pls help PinmemberGriffinPeter13-Nov-09 8:21 
GeneralMy vote of 1 PinmemberDennis Micheelsen8-Nov-09 20:10 
GeneralMy vote of 1 Pinmemberkalyankrishna18-Nov-09 6:30 
GeneralRe: My vote of 1 Pinmemberbalaji252517-Nov-09 7: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 | Mobile
Web04 | 2.8.141022.2 | Last Updated 17 Nov 2009
Article Copyright 2009 by balaji2525
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid