The message was undeliverable. All servers failed to receive the message
public static bool send(string strMto, string strMfrom, string strFname, string strSubject, string strHtml)
{
jmail.Message jmail = new jmail.Message();
string subject = strSubject;
string body = strHtml;
string fromemail = strMfrom;
jmail.FromName = strFname;//发送人姓名
string toemail = strMto;
//silent属性:如果设置为true,jmail不会抛出例外错误. jmail. send( () 会根据操作结果返回true或false
jmail.Silent = false;
//jmail创建的日志,前提loging属性设置为true
jmail.Logging = true;
//字符集,缺省为"us-ascii"
jmail.Charset = "gb2312";
//jmail.ContentTransferEncoding = "base64";
//jmail.Encoding = "base64";
//信件的contentype. 缺省是"text/plain") : 字符串如果你以html格式发送邮件, 改为"text/html"即可。
jmail.ContentType = "text/html";
//添加收件人
jmail.AddRecipient(toemail, "", "");
jmail.From = fromemail;
//发件人邮件用户名
jmail.MailServerUserName = "******";
//发件人邮件密码
jmail.MailServerPassWord = "******";
//设置邮件标题
jmail.Subject = subject;
//邮件添加附件,(多附件的话,可以再加一条jmail.addattachment( "c:\\test.jpg",true,null);)就可以搞定了。〔注〕:加了附件,讲把上面的jmail.contenttype="text/html";删掉。否则会在邮件里出现乱码。
//jmail.AddAttachment( "c:\\test.jpg",true,null);
//邮件内容
jmail.Body = body;
//jmail.Silent = true;
//jmail发送的方法
bool result = jmail.Send("smtp.qq.com", false);
jmail.Close();
return result;
}
代码如上边错误代码 0x8000ffff
bool result = jmail.Send("smtp.qq.com", false);这句报错
请不要拿网上的代码复制粘贴 谢谢。