reza97
چهارشنبه 13 شهریور 1392, 22:21 عصر
سلام دوستان
کجای کد من ایراد داره که ایمیل رو ارسال نمیکنه
SmtpClient obj = new SmtpClient();
MailMessage MailMsg = new MailMessage();
MailMsg.To.Clear();
MailMsg.To.Add(new MailAddress(TextBox25.Text));
MailMsg.From = new MailAddress("mymail@gmail.com");
MailMsg.Subject = "RE:پاسخ ";
MailMsg.BodyEncoding = System.Text.Encoding.UTF8;
MailMsg.IsBodyHtml = true;
obj.Host = "smtp.gmail.com";
System.Net.NetworkCredential basicAuthenticaionInfo = new System.Net.NetworkCredential("mymail@gmail.com", "1340");
obj.UseDefaultCredentials = false;
obj.Credentials = basicAuthenticaionInfo;
MailMsg.Body = CKEditorControl10.Text;
MailMsg.IsBodyHtml = true;
try
{
obj.Send(MailMsg);
Label20.Text = "پیام ارسال شد";
MultiView1.ActiveViewIndex = 12;
CKEditorControl10.Text = "";
TextBox25.Text = "";
}
catch (Exception ex)
{
Label20.Text = "پیام ارسال نشد!لطفا مجددا سعی نماید";
MultiView1.ActiveViewIndex = 12;
}
کجای کد من ایراد داره که ایمیل رو ارسال نمیکنه
SmtpClient obj = new SmtpClient();
MailMessage MailMsg = new MailMessage();
MailMsg.To.Clear();
MailMsg.To.Add(new MailAddress(TextBox25.Text));
MailMsg.From = new MailAddress("mymail@gmail.com");
MailMsg.Subject = "RE:پاسخ ";
MailMsg.BodyEncoding = System.Text.Encoding.UTF8;
MailMsg.IsBodyHtml = true;
obj.Host = "smtp.gmail.com";
System.Net.NetworkCredential basicAuthenticaionInfo = new System.Net.NetworkCredential("mymail@gmail.com", "1340");
obj.UseDefaultCredentials = false;
obj.Credentials = basicAuthenticaionInfo;
MailMsg.Body = CKEditorControl10.Text;
MailMsg.IsBodyHtml = true;
try
{
obj.Send(MailMsg);
Label20.Text = "پیام ارسال شد";
MultiView1.ActiveViewIndex = 12;
CKEditorControl10.Text = "";
TextBox25.Text = "";
}
catch (Exception ex)
{
Label20.Text = "پیام ارسال نشد!لطفا مجددا سعی نماید";
MultiView1.ActiveViewIndex = 12;
}