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. |