Hi Siva,
I think it the problem with the SMTP server Authentication Credential.
SO try this part with you code.
Create an object for the class SMTPClient, another object for network credential, assign the user name and password of a mail address. map that credential to the SMTP client.
It will fix your problem.
Code:
Public Sub SendMail()
Dim strTo As String = frmMain.txtTo.Text
Dim strFrom As String = frmMain.txtFrom.Text
Dim strSubject As String = frmMain.txtSubject.Text
Dim strBody As String = frmMain.txtBody.Text
Dim mailMessage As New System.Net.Mail.MailMessage(strFrom, strTo,
strSubject, strBody)
Dim mailClient As New
System.Net.Mail.SmtpClient("IpAddressOfMyExchangeServer", 25)
mailClient.Credentials = New
NetworkCredential("IpAddressOfMyExchangeServer\UserName", "Password")
mailClient.DeliveryMethod = Net.Mail.SmtpDeliveryMethod.Network
Try
mailClient.Send(mailMessage)
Catch ex As Exception
frmMain.txtInfo.Text = ex.ToString
Exit Sub
End Try
frmMain.txtInfo.Text = "Your message was sucessfully sent."
End Sub
The above code works fine.
Hope useful...