mail message in vb.net

Posted by Sekar.C under VB.NET on 3/20/2012 | Points: 10 | Views : 1576 | Status : [Member] | Replies : 4
hi,
i use this code but not work this code what the problem
Try
Dim SmtpServer As New SmtpClient()
Dim mail As New MailMessage()
SmtpServer.Credentials = New Net.NetworkCredential("username@gmail.com", "password")
SmtpServer.Port = 995
SmtpServer.Host = "smtp.gmail.com"
SmtpServer.EnableSsl = True
mail = New MailMessage()
mail.From = New MailAddress("sekar.mca@gmail.com")
mail.To.Add("sathiyaraj@gmail.com")
mail.Subject = "Test Mail"
mail.Body = "This is for testing SMTP mail from GMAIL"
SmtpServer.Send(mail)
MsgBox("mail sent")
Catch ex As Exception
MsgBox(ex.Message)
End Try


Regards
Sekar.c



Responses

Posted by: Vforvijay on: 3/20/2012 [Member] Starter | Points: 25

Up
0
Down

Posted by: Sksamantaray on: 3/21/2012 [Member] Silver | Points: 25

Up
0
Down
Make the port 25 and check

Thanks,
Sanjay

Sekar.C, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: perfectchourasia-9163 on: 4/3/2012 [Member] Starter | Points: 25

Up
0
Down
http://sandeep-chourasia.blogspot.in/2011/05/send-mail-in-aspnet.html

ER sandeep chourasia
sandeepchrs@yahoo.com (on facebook)
http://www.aspnetcodes.com/

Sekar.C, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hmanjarawala on: 4/3/2012 [Member] Bronze | Points: 25

Up
0
Down
Try this,

Try

Dim SmtpServer As New SmtpClient()

Dim mail As New MailMessage()

SmtpServer.Credentials = New Net.NetworkCredential("username@gmail.com", "password")

SmtpServer.Port = 587

SmtpServer.Host = "smtp.gmail.com"

SmtpServer.EnableSsl = True

mail = New MailMessage()

mail.From = New MailAddress("sekar.mca@gmail.com")

mail.To.Add("sathiyaraj@gmail.com")

mail.Subject = "Test Mail"

mail.Body = "This is for testing SMTP mail from GMAIL"

SmtpServer.Send(mail)

MsgBox("mail sent")

Catch ex As Exception

MsgBox(ex.Message)

End Try


Himanshu Manjarawala
Sr. Software Engineer@AutomationAnywhere
http://fieredotnet.wordpress.com/

Sekar.C, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response