C
Crespo
hi,every one!
I have a question about sending emails.My codes works well over some
smtp servers,but doesn't over the others. My codes is listed belowed:
try
{
MailMessage mailObj = new MailMessage();
mailObj.To.Add(receipientAddr);
mailObj.From = new MailAddress(senderAddr);
mailObj.Subject = "very good";
mailObj.Body = "thank you";
mailObj.IsBodyHtml = true;
mailObj.Priority = MailPriority.High;
mailObj.BodyEncoding = System.Text.Encoding.UTF8;
System.Net.Mail.SmtpClient client = new
System.Net.Mail.SmtpClient(smtpServerIP);
client.UseDefaultCredentials = false;
mailObj.SubjectEncoding = System.Text.Encoding.UTF8;
client.Credentials = new
System.Net.NetworkCredential(this.tb_mailUserName.Text,
this.tb_mailUserPassword.Text);
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.Send(mailObj);
}
catch(Exception ex)
{
MessageBox.Show(ex.Message.ToString());
return;
}
when smtpServerIP is specified with some smtp server ips, the mail can be
delievered correctly.But over some smtp servers such as "smtp.21cn.com",the
codes didn't throw any exception and seemed to have work well,but when I
logined mail.21cn.com,I could not find the expectedly incoming mail. Could
anyone help me?
Crespo
2006-07-03
I have a question about sending emails.My codes works well over some
smtp servers,but doesn't over the others. My codes is listed belowed:
try
{
MailMessage mailObj = new MailMessage();
mailObj.To.Add(receipientAddr);
mailObj.From = new MailAddress(senderAddr);
mailObj.Subject = "very good";
mailObj.Body = "thank you";
mailObj.IsBodyHtml = true;
mailObj.Priority = MailPriority.High;
mailObj.BodyEncoding = System.Text.Encoding.UTF8;
System.Net.Mail.SmtpClient client = new
System.Net.Mail.SmtpClient(smtpServerIP);
client.UseDefaultCredentials = false;
mailObj.SubjectEncoding = System.Text.Encoding.UTF8;
client.Credentials = new
System.Net.NetworkCredential(this.tb_mailUserName.Text,
this.tb_mailUserPassword.Text);
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.Send(mailObj);
}
catch(Exception ex)
{
MessageBox.Show(ex.Message.ToString());
return;
}
when smtpServerIP is specified with some smtp server ips, the mail can be
delievered correctly.But over some smtp servers such as "smtp.21cn.com",the
codes didn't throw any exception and seemed to have work well,but when I
logined mail.21cn.com,I could not find the expectedly incoming mail. Could
anyone help me?
Crespo
2006-07-03