try
{
jmail.MessageClass MyMail=new jmail.MessageClass();
MyMail.Charset = "GB2312";// 字符集
MyMail.Encoding = "BASE64";//附件的编码格式
MyMail.ContentType = "text/html";
MyMail.ISOEncodeHeaders = false;//信头编码iso-8859-1字符集
MyMail.Priority = Convert.ToByte(1);//优先级
MyMail.From = "[email protected]";//发送人邮件地址
MyMail.FromName = "al";//发送人姓名
MyMail.Subject = "test";// 邮件主题
MyMail.MailServerUserName = "sendmail";//身份验证用户名
MyMail.MailServerPassWord = "sendmail";//用户密码
MyMail.AddRecipient("[email protected]","","");//收件人邮箱
MyMail.Body = "nihao";//邮件内容
if (MyMail.Send("192.168.0.18",false))
{
Response.Write("<script>alert('发送成功!');</script>");
}
else
{
Response.Write("<script>alert('发送失败!');</script>");
}
MyMail.Close();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}为什么,if (MyMail.Send("192.168.0.18",false)) 就出现The message was undeliverable. All servers failed to receive the message 错误了
解决方案 »
- 请问有什么好的打包工具,或者说怎么最小打包
- 重绘怎么才能不闪烁
- GDI得TextRenderer.DrawText 方法画的文字超出指定矩形的边界
- MouseMove的一个问题.
- 怎样判断线程是否结束?--在线等待
- datagridview 更改为Detail的时候用BindingNavigator出错,很棘手
- 初学者:求C#程序,如何取得ACCESS表中的主键的字段名!
- listview中的checkbox可不可以设enabled=false
- datagrid控件怎样自适应列宽
- .net在2000和98下的性能为什么相差这么大?
- 在Compact framework2.0 如何Serializable
- 关于地址传递值
String Subject = "新用户注册通知";
String body = "欢迎";
String FromEmail = "";
String ToEmail = strRC_Mail;
Jmail.Silent = false;//Silent属性:如果设置为true,JMail不会抛出例外错误. JMail. Send( () 会根据操作结果返回true或false
Jmail.Logging = false;
Jmail.Charset = "GB2312";
Jmail.ContentType = "text/html";
Jmail.AddRecipient(ToEmail, "", "");
Jmail.From = FromEmail;
Jmail.MailServerUserName = "";
Jmail.MailServerPassWord = "";
Jmail.Subject = Subject;
Jmail.Body = body.ToString();
Jmail.Send("smtp.qq.cn", false);
Jmail.Close();发不出去可能的问题你可以利用Silent来获取看是哪里的错。不要给我分,我这号不要分。
提示 The message was undeliverable. All servers failed to receive the message 错误
//jmail.Message MyMail = new jmail.Message();
MyMail.ContentType="text/html";
MyMail.Silent=false;
MyMail.Logging=true;
MyMail.Charset="GB2312";
MyMail.AddRecipient("[email protected]","","");
MyMail.From="[email protected]";
MyMail.MailServerUserName="123456";//
MyMail.MailServerPassWord="123456";//
MyMail.Subject="主题";
MyMail.Body="内容";
MyMail.Send("smtp.126.com",false);
this.labTest.Text="3";
MyMail.Close() 这么写 还是上面的错误
http://www.cnblogs.com/ilcw/articles/1237425.html
http://topic.csdn.net/u/20070524/10/253f356d-2211-484c-9ce5-29b4f37d40f5.html