Hello,
I'm trying to get an ASP.net web application to send email. I've seen several problems in the forums relating to this, but my problem hasn't been solved by reading them. Here's (essentially) the code:
The function that this code is inside of is returning true when called, however, the email never arrives at the hotmail account. When I send the email to me@mydomain (the same domain that the asp.net app is on), the email comes through just fine.
I've tried using smtp authentication when sending also, but with the same result...
Any ideas as to what might be causing the email to not be sent with no errors reported?
I'm trying to get an ASP.net web application to send email. I've seen several problems in the forums relating to this, but my problem hasn't been solved by reading them. Here's (essentially) the code:
Code:
MailMessage msg = new MailMessage();
msg.To = "[email protected]";
msg.From = "[email protected]";
msg.Subject = "A Subject";
msg.BodyFormat = MailFormat.Html;
msg.Body = "<html><body>...and such...</body></html>";
try
{
SmtpMail.SmtpServer = "localhost";
SmtpMail.Send(msg);
}
catch (Exception e)
{
return false;
}
return true;
The function that this code is inside of is returning true when called, however, the email never arrives at the hotmail account. When I send the email to me@mydomain (the same domain that the asp.net app is on), the email comes through just fine.
I've tried using smtp authentication when sending also, but with the same result...
Code:
msg.Fields["http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"] = 1;
msg.Fields["http://schemas.microsoft.com/cdo/configuration/sendusername"] = "[email protected]";
msg.Fields["http://schemas.microsoft.com/cdo/configuration/sendpassword"] = "password";
Any ideas as to what might be causing the email to not be sent with no errors reported?