M
Max
hi
I used mailmessage object to send the mail, my smtp server don't
require authentication, when i try to send the mail it shows error.
following is the code to send mail.
Dim mymail As New MailMessage
Dim smtp As SmtpMail
smtp.SmtpServer = "mailhost.gujarat.gov.in"
mymail.To = "(e-mail address removed)"
mymail.From = "mahesh (check mail delivery)"
mymail.Subject = "check mail delivery"
mymail.Body = "hi this is to check mail delivery"
mymail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport",
"25")
mymail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpusessl",
"true")
Try
smtp.Send(mymail)
Label1.Text = "Mail sucessfully deliverd"
Catch ex As Exception
Label1.Text = ex.Message & "<br>" &
ex.GetBaseException.ToString
End Try
here i have add smtpserverport and smtpusessl fields only i have not
added smtpauthenticate.
now when i add smtpauthenticate=0 it shows same error.
if i remove all the fields and olny assign smtp.SmtpServer if through
following error.
Could not access 'CDO.Message' object.
System.Runtime.InteropServices.COMException (0x8004020E): The server
rejected the sender address. The server response was: 501 : domain
string is NULL.
Please Let me know if any one know the solution
I used mailmessage object to send the mail, my smtp server don't
require authentication, when i try to send the mail it shows error.
following is the code to send mail.
Dim mymail As New MailMessage
Dim smtp As SmtpMail
smtp.SmtpServer = "mailhost.gujarat.gov.in"
mymail.To = "(e-mail address removed)"
mymail.From = "mahesh (check mail delivery)"
mymail.Subject = "check mail delivery"
mymail.Body = "hi this is to check mail delivery"
mymail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport",
"25")
mymail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpusessl",
"true")
Try
smtp.Send(mymail)
Label1.Text = "Mail sucessfully deliverd"
Catch ex As Exception
Label1.Text = ex.Message & "<br>" &
ex.GetBaseException.ToString
End Try
here i have add smtpserverport and smtpusessl fields only i have not
added smtpauthenticate.
now when i add smtpauthenticate=0 it shows same error.
if i remove all the fields and olny assign smtp.SmtpServer if through
following error.
Could not access 'CDO.Message' object.
System.Runtime.InteropServices.COMException (0x8004020E): The server
rejected the sender address. The server response was: 501 : domain
string is NULL.
Please Let me know if any one know the solution