View Single Post
  #3 (permalink)  
Old 02-22-2008, 08:33 PM
psivakumarmca81 psivakumarmca81 is offline
D-Web Trainee
 
Join Date: Feb 2008
Posts: 4
psivakumarmca81 is on a distinguished road
Default Re: How to send email in VB.NET 2005(From Windows Applications)

[quote=prasannavigneshr;22875]Hi sivakumar,

Welcome to Discussweb IT Community,

Sending a email using ASP.NET 2.0 and VB.NET is actually very simple.

First, you will need to import the System.Net.Mail namespace.

The System.Net.Mail namespace contains the SmtpClient and MailMessage Classes that we need in order to send the email.

Use the btnSubmit_Click event to do the work.

Code:
Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click

Try

Dim message As New MailMessage(ToAddress, From Address, Subject, Message)
Dim emailClient As New SmtpClient(your SMTP Server Address) \\ smtp.gmail.com
emailClient.Send(message)

Catch ex As Exception

End Try
End Sub
If you need more assistance post your code here...

Actually, i have tried with the above code but still i have an error. I want to send the mail with smtp authentication. I think in our smtp server this rights have been restricted. I don't know about the server restrictions. Kindly help needed prasanna.

Thank you.
Reply With Quote