Hi There
I'm trying to write a code that send email. Created a service, deployed in the server where i have configured the smtp settings.
When sending the email i'm getting the following error and also see the piece of code.
"The remote name could not be resolved. smtp.servername.edu.gov.za"
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient("smtp server");
mail.From =
new MailAddress("source");
mail.To.Add(
"destination");
mail.Subject =
"Testing";
mail.Body =
"Awe TestingL";
SmtpServer.Port = 25;
SmtpServer.EnableSsl =
true;
SmtpServer.Send(mail);
MessageBox.Show("mail Send");
May you please assist.
Loading
Matiki MahlanguPosted Nov 3, 2014, 8:29 AM
I think my smtp settings were not configured correctly.
I'm finding difficult to do the smtp service testing
Dipankar BiswasPosted Nov 3, 2014, 4:10 AM
Try
' some code that is susceptible to throw exception.
Catch ex As Exception
Response.Write(ex.Message)
While Not ex.InnerException Is Nothing
Response.Write(ex.InnerException.Message)
ex = ex.InnerException
End While
End Try
It would be giving u the detail description of what might be the problem.Also check that there might be some problem in connecting to remote server as exception implies "WebException , the remote name could not be resolved".
see this link.http://forums.asp.net/t/992641.aspx?WebException+the+remote+name+could+not+be+resolved
or see this example
...