关于JAVAMAIL 发邮件的问题~

cherry____ 2012-04-10 09:24:01
源代码如下:

import javax.mail.PasswordAuthentication;
import java.util.Properties;

import javax.mail.Authenticator;
import javax.mail.Message;
import javax.mail.Message.RecipientType;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;

public class Demon2 {


public static void main (String[] args) throws Exception {

Properties props=new Properties();
props.setProperty("mail.smtp.auth", "true");
props.setProperty("mail.transport.protocol", "smtp");
props.setProperty("mail.host", "smtp.sina.com");


Session session=Session.getInstance(props,
new Authenticator()
{
protected PasswordAuthentication getPasswordAuthentication()
{
return new PasswordAuthentication("cherryfun","cherry");
}
}
);

session.setDebug(true);
Message msg=new MimeMessage(session);
msg.setRecipients(RecipientType.TO,
InternetAddress.parse("cherryfun@sina.com,272640074@qq.com"));
msg.setFrom(new InternetAddress("lili@sina.com"));
msg.setSubject("o o ");
msg.setContent("<span style:color='red'>你是我的唯一</span>", "text/html;charset=gbk");

Transport.send(msg);

}

}



在控制台显示邮件已经发出去了。。可是为什么我用LIVE MAIL接受不到我刚刚发送的邮件?,也没我发送邮件的记录
Content-Transfer-Encoding: quoted-printable

<span style:color=3D'red'>=C4=E3=CA=C7=CE=D2=B5=C4=CE=A8=D2=BB</span>
.
250 ok: Message 1795557198 accepted
QUIT
221 irxd5-183.sinamail.sina.com.cn
...全文
56 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

50,531

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧