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

How to send email in from VB.NET(2005) in Windows application.
I have tried with the following code. But i am unable to send.


Imports System.Web.Mail

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim myMessage As System.Web.Mail.MailMessage
Try
myMessage = New System.Web.Mail.MailMessage
With myMessage
.To = "abc@xyz.co.in"
.From = "abc@xyz.co.in"
.Subject = "Testing Mail "
.Body = "This is a testing mail without attachments"
.BodyFormat = System.Web.Mail.MailFormat.Html
End With
System.Web.Mail.SmtpMail.SmtpServer = "smtp.servername.com"
System.Web.Mail.SmtpMail.Send(myMessage)

Catch myexp As Exception
MsgBox(myexp.Message, MsgBoxStyle.Critical, Me.Text)
End Try
End Sub

But it shows the error.

"The server rejected one or more recipient addresses. The server response was: 553 sorry, Authentication failed or timed out. Please do get messages first to authenticate yourself.(#4.4.3)".

But the above code has successfully executed before 2 months.Now it is not.I don't know where the problem has occured. We are using the smtp server. Please help.
Reply With Quote
Sponsored Links