PDA

View Full Version : سوال: خطا در ارسال ایمیل در VS2008



alialirezaee1
سه شنبه 29 اردیبهشت 1388, 01:16 صبح
در این کد زیر خطای Failure sending mail. میده. کجای کارم اشتباه است؟
در ضمن سرور mail.yahoo.com هم امتحان کردم همین خطا میده و سرور smtp.mail.yahoo.com خطای The SMTP server requires a secure connection or the client was not authenticated. The server response was: authentication required - "for help go to http://help.yahoo.com/help/us/mail/pop/pop-11.html" میده.


try
{
System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("aa.mg1.mail.yahoo.com");
smtp.Credentials = new System.Net.NetworkCredential("USERNAME@yahoo.com", "PASSWORD");
System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();
MailAddress it = new MailAddress("USERNAME@yahoo.com", "FAKE NAME");
message.To.Add(it);
message.Subject = "This is the Subject line";
message.From = new System.Net.Mail.MailAddress("USERNAME@yahoo.com");
message.Body = "This is the message body";
smtp.Send(message);
}
catch (Exception ex)
{
LBL_Status.Text = "Send Email Failed." + ex.Message;
}