Sender address<*@*>domain does not exist 的解决方法
2016-11-01 16:15
323 查看
项目中需要用到发邮件进行数据变更的申请,在写发送邮件的功能的时候遇到如题报错。查阅相关资料后记录于此....
原因分析:
一封邮件包含的属性有:主题、内容、主送、抄送,但别忘了还有发件人。出现如上报错就是因为没有填写发件人地址,导致默认取本地的发件域,如果你本地的计算机名字叫test,取得的域为"test@test",而这个地址在DNS解析的时候是无效的,所以报错。
解决方法:加上发件人地址即可。源码如下:
//邮件主体Start
Mail mail=new Mail();
if(zS.size()>0)
mail.setTo(this.listToStrings(zS));
if(cS.size()>0)
mail.setCc(this.listToStrings(cS));
mail.setSubject(subject);
mail.setText(content);
//加上有效的发件人地址即可
mail.setFrom(localJavaMailSenderImpl.getUsername());
mail.setHTML(true);
//邮件主体End
//发送申请邮件
this.mailBO.sendMail(localJavaMailSenderImpl,mail,true);
原因分析:
一封邮件包含的属性有:主题、内容、主送、抄送,但别忘了还有发件人。出现如上报错就是因为没有填写发件人地址,导致默认取本地的发件域,如果你本地的计算机名字叫test,取得的域为"test@test",而这个地址在DNS解析的时候是无效的,所以报错。
解决方法:加上发件人地址即可。源码如下:
//邮件主体Start
Mail mail=new Mail();
if(zS.size()>0)
mail.setTo(this.listToStrings(zS));
if(cS.size()>0)
mail.setCc(this.listToStrings(cS));
mail.setSubject(subject);
mail.setText(content);
//加上有效的发件人地址即可
mail.setFrom(localJavaMailSenderImpl.getUsername());
mail.setHTML(true);
//邮件主体End
//发送申请邮件
this.mailBO.sendMail(localJavaMailSenderImpl,mail,true);
相关文章推荐
- 【Vegas原创】outlook发送时,报550 5.7.1 client does not have permissions to send as this sender解决方法
- java.io.FileNotFoundException: class path resource [beans.xml] cannot be opened because it does not exist 解决方法
- Activity class {package/class} does not exist及Unable to start activity ComponentInfo 解决方法
- 关于The target "GetCopyToOutputDirectoryContentProjectItems" does not exist in the project.的解决方法
- foxit updater.exe does not exist的解决方法
- oracle安装后 tomcat启动报 Address already in use: JVM_Bind<null>:8080 错误 的几种解决方法
- mySql问题:The user specified as a definer ('root'@'%') does not exist 解决方法
- 新建数据库时出现collation '<服务器默认值>'is not valid.(Microsoft.SqlServer,Express.smo)的解决方法
- Visual Studio 2010 发布Web项目提示The target "PipelinePreDeployCopyAllFilesToOneFolder" does not exist in the project.解决方法
- jspsmartupload Files' name is invalid or does not exist的解决方法
- Error:The type or namespace name 'Office' does not exist in the namespace 'Microsoft' 解决方法
- Activity class {package/class} does not exist及Unable to start activity ComponentInfo 解决方法
- oracle ORA-27101 Shared memory realm does not exist解决方法
- 关于 bin/resources.ap_ does not exist 的解决方法
- Serv_U 安全设置以后出现530 Not logged in, home directory does not exist的解决方法
- 关于resources.ap_ does not exist的解决方法
- SQL server 2005 创建数据库失败提示“Collation <服务器默认值> is not valid”解决方法
- mysql 1449 : The user specified as a definer ('root'@'%') does not exist 解决方法
- Error:The name 'Encoding' does not exist in the current context 解决方法
- SQL server 2005 创建数据库失败提示“Collation <服务器默认值> is not valid”解决方法