views:

29

answers:

1

Does anyone know what the smtp mail configuration settings are that is needed in the web.config file to send outgoing mail through a form in ASP? Thanks.

A: 

Check out this link: Yahoo POP3 and SMTP Settings

My guess is the following should work in your code (not exactly sure about credentials as I do not have an account to test with):

MailMessage mail = new MailMessage();  
mail.From = new MailAddress("[email protected]");  
mail.To.Add("[email protected]");  
mail.Subject = "The Subject";  
mail.Body = "Body text here";  
mail.IsBodyHtml = true;  
mail.Priority = MailPriority.High;  
SmtpClient smtp = new SmtpClient("smtp.mail.yahoo.com");  
smtp.Port = 465;  // this could be 587, not sure
smtp.Credentials = new NetworkCredential("YourYahooId", "YourYahooPassword");  
smtp.EnableSsl = true;  // SSL is required I think
smtp.Send(mail);  

The key is to make sure you are using SSL and send authentication credentials. I don't think you will be able to do SSL with just the web.config mail settings. Please see this question for more information.

Kelsey
thanks, but now I recieve a SmtpException was unhandled by user code. I am not sure what this means.
jpavlov
The EnableSsl was throwing the same error, I tricked out my web.config file with the following. <smtp deliveryMethod="Network" from="Jeff <jeffrey.p***[email protected]>"> <network host="smtp.mail.yahoo.com" userName="********" password="******" />Now I am up and running. Thanks for the help.
jpavlov
@jpavlov If this helped you don't for get to give it an upvote or even mark it as the accepted answer :)
Kelsey
Hi Kelsey,It wasn't the enable SSL on my end, more of having the correct configuration settings on my part. See my comment above. But thanks.
jpavlov