当前位置: 代码迷 >> Java Web开发 >> 关于apache common-mail发邮件,部分邮箱无法接收有关问题
  详细解决方案

关于apache common-mail发邮件,部分邮箱无法接收有关问题

热度:1036   发布时间:2016-04-17 13:01:34
关于apache common-mail发邮件,部分邮箱无法接收问题
最近用common-mail做邮件发送,但部分邮箱总是无法接收,一直找不到原因,请高手指点一下,谢谢!
代码:
//yahoo
// String   hostName   =   "smtp.qq.com ";
// String   from   =   "funcreal@qq.com ";
// String   username= " ";
// String   password= " ";

String   to   =   "funcreal@yahoo.com.cn ";

email.setHostName(hostName);
email.setFrom(from);
email.setAuthentication(username,password);

email.addTo(to);
email.setSubject( "Test   email   with   inline   image ");
email.setMsg( "test   msg ");
email.send();

现象:有些邮箱总是无法收到邮件。有人说是被拒绝了。但是用同样的帐户,用outlook或者foxmail就可以发过去。用代码发和用outlook发有什么不同呢?难道用代码发送,会在邮件头增加某种转发ip地址等信息?这个也说不太通。我在foxmail中查看邮件原始信息(这是个可以接收代码发送的邮件的信箱),代码发的和outlook发的是基本相同的,只是头信息中部分信息不同(于是我在代码中加入了outlook的头信息,让它看起来和outlook相同)。请看示例:
Received:   from   172.16.81.117   (unknown   [172.16.81.117])
by   smtpbg10.qq.com   (Postfix)   with   SMTP   id   2A93B54057
for   <11144556@qq.com> ;   Tue,     4   Sep   2007   09:34:22   +0800   (CST)
X-QQ-mid:mx7118886966232618933
Received:   from   eyou.net   (unknown   [211.138.7.45])
by   mx7.qq.com   (Postfix)   with   SMTP   id  
for   <11144556@qq.com> ;   Tue,     4   Sep   2007   09:34:22   +0800   (CST)
X-QQ-SPAM:   false
X-QQ-ASM:   000   0.00000000   000
X-EYOU-SPAMVALUE:0
X-EYOU-DEALDRC:
Received:   (eyou   anti_spam   gateway   3.0);   Tue,   04   Sep   2007   09:34:35   +0800
Message-ID:   <388869675.26663@eyou.net>
X-EYOUMAIL-SMTPAUTH:   13503290132@139cn.net
Received:   from   211.138.9.91   by   192.168.2.10   with   SMTP;   Tue,   04   Sep   2007   09:34:35   +0800
Message-ID:   <4875224.1188869776478.JavaMail.fangrui_qt@211.138.7.42>
Date:   Tue,   4   Sep   2007   09:04:41   +0800
From:   "13503290132@139cn.net "   <13503290132@139cn.net>
To:   "11144556@qq.com "   <11144556@qq.com>
Subject:   Test   email   with   inline   image

Mime-Version:   1.0
Content-Type:   text/plain;   charset= "gb2312 "
Content-Transfer-Encoding:   base64
X-Priority:   3
X-MSMail-Priority:   Normal
X-Mailer:   Microsoft   Outlook   Express   6.00.3790.3959
X-MimeOLE:   Produced   By   Microsoft   MimeOLE   V6.00.3790.3959

有人知道怎么回事吗?


------解决方案--------------------
开头少了个声明:SimpleEmail email = new SimpleEmail();
  相关解决方案