alia.n
یک شنبه 16 مهر 1391, 00:04 صبح
سلام دوستان من وقتی که سایتم را آپلود نکردم به راحتی رو ی سیستم خودم در صورتی که به اینترنت متصل باشم ایمیل ارسال میکنم اما وقتی سایتم رو روی هاست Somee آپلود کردم وقتی ایمیل ارسال میکنم با پیام زیر روبه رو میشم.
System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required. Learn more at at System.Net.Mail.MailCommand.CheckResponse(SmtpStat usCode statusCode, String response) at System.Net.Mail.MailCommand.Send(SmtpConnection conn, Byte[] command, String from) at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, SmtpFailedRecipientException& exception) at System.Net.Mail.SmtpClient.Send(MailMessage message) at User_Relation.Button1_Click(Object sender, EventArgs e)
کد ارسال ایمیلم اینه
MailAddress from = new MailAddress("ali123@gmail.com", Encoding.UTF8);
MailAddress to = new MailAddress("ali@gmail.com");
MailMessage message = new MailMessage(from, to);
message.Subject =tbSubject.Text;
message.SubjectEncoding = Encoding.UTF8;
message.Body = tbContext.Text;
message.BodyEncoding = Encoding.UTF8;
SmtpClient client = new SmtpClient();
client.Host = "smtp.gmail.com";
client.Port = 587;
client.EnableSsl = true;
client.Credentials = new NetworkCredential("ali@gmail.com", "123???");
try
{
client.Send(message);
Label1.Text = "پیام با موفقیت ارسال شد.";
}
catch (System.Net.Mail.SmtpException exp)
{ Label7.Text = exp.ToString();
}
System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required. Learn more at at System.Net.Mail.MailCommand.CheckResponse(SmtpStat usCode statusCode, String response) at System.Net.Mail.MailCommand.Send(SmtpConnection conn, Byte[] command, String from) at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, SmtpFailedRecipientException& exception) at System.Net.Mail.SmtpClient.Send(MailMessage message) at User_Relation.Button1_Click(Object sender, EventArgs e)
کد ارسال ایمیلم اینه
MailAddress from = new MailAddress("ali123@gmail.com", Encoding.UTF8);
MailAddress to = new MailAddress("ali@gmail.com");
MailMessage message = new MailMessage(from, to);
message.Subject =tbSubject.Text;
message.SubjectEncoding = Encoding.UTF8;
message.Body = tbContext.Text;
message.BodyEncoding = Encoding.UTF8;
SmtpClient client = new SmtpClient();
client.Host = "smtp.gmail.com";
client.Port = 587;
client.EnableSsl = true;
client.Credentials = new NetworkCredential("ali@gmail.com", "123???");
try
{
client.Send(message);
Label1.Text = "پیام با موفقیت ارسال شد.";
}
catch (System.Net.Mail.SmtpException exp)
{ Label7.Text = exp.ToString();
}