Hi, I have tried to use the example code found at http://support.Winhost.com/KB/a650/how-to-send-email-in-aspnet.aspx but I am getting a Unable to connect to the remote server exception. here is my code // Create the smtp client var smtp = new SmtpClient("mail.outthedoghouse.com.au"); smtp.Credentials = new NetworkCredential("[email protected]", **Password**); //smtp.Port = 25; // also I not tried with 587; smtp.Port = 587; // Send the message smtp.Send(mail); Can you tell me why this is so? The Domain in question is "outthedoghouse.com.au" the mx record resolves to m04.internetmailserver.net
Everything looks right. Try setting the trust level to 'Full' in your web.config file: http://support.Winhost.com/KB/a657/changing-the-default-aspnet-trust-level.aspx
Update: Elshadriel: the web config already as this setting. I have made a Test project in visual studio and can run this exact code and get the email to go through. So it looks like this i a problem when running in the web environment from visual studio.
It might be another configuration setting in your web.config file. You should try uploading a test script and a more simplified web.config file. If it works, then you know there is some setting in the web.config that you need to modify.
I have same problem with. Everything worked fine but now not working. My peace of code: ============================= AlternateView htmlView = AlternateView.CreateAlternateViewFromString(bodyHTML, null, "text/html"); mailMsg.AlternateViews.Add(htmlView); SmtpClient smtp = new SmtpClient("mail.srpski-despot.com"); NetworkCredential Credentials = new NetworkCredential("[email protected]", "****"); smtp.Credentials = Credentials; //smtp.Port = 587; //smtp.Timeout = 20000; smtp.Send(mailMsg); lblRezultat.Text = "success"; ================== web.config: ============== .... <system.web> <trust level="Full"/> .... ============== Before few months everything worked fine. But now same code not working. I get error: ======== Mailbox unavailable. The server response was: <[email protected]> No such user here. ======== [email protected] email address where I send e-mail.
Double check that you're entering the correct password. You might get that message if you fail SMTP authentication.