2

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.

Kelsey
  • 47,246
  • 16
  • 124
  • 162
jpavlov
  • 2,215
  • 9
  • 43
  • 58

3 Answers3

1

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("fromname@somewhere.com");  
mail.To.Add("toname@somewhereelse.com");  
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.

Community
  • 1
  • 1
Kelsey
  • 47,246
  • 16
  • 124
  • 162
  • thanks, but now I recieve a SmtpException was unhandled by user code. I am not sure what this means. – jpavlov Jul 19 '10 at 23:14
  • The EnableSsl was throwing the same error, I tricked out my web.config file with the following. Now I am up and running. Thanks for the help. – jpavlov Jul 19 '10 at 23:57
  • @jpavlov If this helped you don't for get to give it an upvote or even mark it as the accepted answer :) – Kelsey Jul 19 '10 at 23:59
  • 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 Aug 26 '10 at 15:49
0
SMTP_SERVER = "smtp.mail.yahoo.com"
SMTP_PORT = 587
SMTP_USERNAME = "username" // username@yahoo.com
SMTP_PASSWORD = "password" 
xpros
  • 2,166
  • 18
  • 15
0

See the How to utilize Google gmail server in your.NET Web & Windows Applications article. That code work for me. If it doesn't work for you, send mail to me(pandiansaamy@gmail.com)

Rob
  • 415,655
  • 72
  • 787
  • 1,044