我用jmail给邮箱发送邮件,有一个地方是要写服务器的,这个服务器就是我本机的名称吗?
点击发送之后提示错误是:The message was undeliverable,All servers failed to recivie the message
请问这是什么意思呀?
点击发送之后提示错误是:The message was undeliverable,All servers failed to recivie the message
请问这是什么意思呀?
解决方案 »
- DataGrid 中嵌套DropDownList的问题
- 缺少对公共可见类型 。。。。。。。XML注释
- 打开execl文件出现服务器意外情况?
- 2003里DataRrid控件中的 e.Item.ItemType 在2005 GridView 里怎么写啊?help
- 如何在 Visual Studio .Net 中调试 SQL Server 存储过程
- DataGrid中的鼠标事件?
- Asp.Net,Default页面代码中创建另一线程无法更新界面
- 关于Gridview 模板列的问题?
- 关于MS系统邮件发送的问题,急!
- 关于切割图片的问题
- 100分求一个正则表达式--------------------------------------急!!!!!!
- sql如何向远程数据库插入数据,并且如果发生错误,如何能回滚??
*****************************************************************************
欢迎使用CSDN论坛专用阅读器 : CSDN Reader(附全部源代码)
http://feiyun0112.cnblogs.com/
{
jmail.Message Jmail=new jmail.Message();
DateTime t=DateTime.Now;
String Subject=" From EMail .net";
String body="你好科学12:15";
String FromEmail="[email protected]";
String ToEmail="[email protected]";
//Silent属性:如果设置为true,JMail不会抛出例外错误. JMail. Send( () 会根据操作结果返回true或false
Jmail.Silent=true;
//Jmail创建的日志,前提loging属性设置为true
Jmail.Logging=true;
//字符集,缺省为"US-ASCII"
Jmail.Charset="GB2312";
//信件的contentype. 缺省是"text/plain") : 字符串如果你以HTML格式发送邮件, 改为"text/html"即可。
Jmail.ContentType="text/html";
//添加收件人
Jmail.AddRecipient(ToEmail,"","");
Jmail.From=FromEmail;
//发件人邮件用户名
Jmail.MailServerUserName="ljt21" ;
//发件人邮件密码
Jmail.MailServerPassWord="****" ;
//设置邮件标题
Jmail.Subject=Subject;
//邮件添加附件,(多附件的话,可以再加一条Jmail.AddAttachment( "c: est.jpg",true,null);)就可以搞定了。[注]:加了附件,讲把上面的 Jmail.ContentType="text/html";删掉。否则会在邮件里出现乱码。
Jmail.AddAttachment( "c: est.jpg",true,null);
//邮件内容
Jmail.Body=body+t.ToString();
//Jmail发送的方法
Jmail.Send("smtp.163.com",false);
Jmail.Close() ;
}
Jmail发送首先要通过邮件服务器验证。
如果你的服务器不支持SMTP或者你的账号不能使用SMTP服务
那么就无法发送
发送到163等看看
代码参考
http://www.cnblogs.com/wenming205/articles/1238035.html
protected void Button1_Click(object sender, EventArgs e)
{
try
{
sendEmail(txtSender.Text.Trim(), txtReceiver.Text.Trim(), txtSubject.Text.Trim(), txtContent.Text.Trim(), txtEServer.Text.Trim()); }
catch (Exception ex)
{
Response.Write("<script>alert('" + ex.Message.ToString() + "')</script>");
}
} public void sendEmail(string sender, string receiver, string subject, string body, string eserver)
{
jmail.MessageClass jmMessage = new jmail.MessageClass();
jmMessage.ISOEncodeHeaders = false;
jmMessage.From = sender;
jmMessage.Subject =Base64Encode(subject);
jmMessage.AddRecipient(receiver, "", "");
if (this.upFile.PostedFile.ContentLength != 0)
{
string sFilePath = this.upFile.PostedFile.FileName;
jmMessage.AddAttachment(@sFilePath, false, "");
}
jmMessage.Body = Base64Encode(body);
if (jmMessage.Send(eserver, false))
{
Page.RegisterClientScriptBlock("ok", "<script language=javascript>alert('发送成功')</script>");
}
else
Page.RegisterClientScriptBlock("ok", "<script language=javascript>alert('发送失败,请仔细检查邮件服务器的设置是否正确!')</script>");
jmMessage = null;
}
错误还是这个The message was undeliverable,All servers failed to recivie the message