用javamail免认证方式发送邮件给163.com的用户的…

2008-02-23 10:06:42来源:互联网 阅读 ()

新老客户大回馈,云服务器低至5折

Java代码:


---------------------------------------------------------------------------------------


package com.lizongbo;

import java.util.*;
import javax.mail.internet.*;
import javax.mail.*;

/**
* <p>Title: JavaMail to 163 </p>
*
* <p>Description: 用javamail免认证方式发送邮件给163.com的用户,
* 具体原理不在此作详细解说,有兴趣者请自行查阅相关资料。
* /p>
*
* <p>Copyright: Copyright (c) 2005</p>
*
* <p>Company: lizongbo </p>
*
* @author lizongbo http://www.donews.net/lizongbo
* @version 1.0
*/
public class JavaMail163 {

public static void main(String[] args) throws AddressException,
MessagingException {
Properties mailpro = new Properties();
mailpro.setProperty("mail.smtp.host", "202.108.44.210");
Session session = Session.getDefaultInstance(mailpro);
session.setDebug(true);
MimeMessage msg = new MimeMessage(session);
msg.setFrom(new InternetAddress("lizongbo@gmail.com"));
msg.setRecipient(Message.RecipientType.TO,
new InternetAddress("li_zongbo@163.com"));
msg.setSubject("测试免认证方式发送邮件!!!");
msg.setText("测试一下,邮件来自 http://www.donews.net/lizongbo ");
Transport.send(msg);
}
}


---------------------------------------------------------------------------------------

执行结果:

---------------------------------------------------------------------------------------

DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]

DEBUG SMTP: useEhlo true, useAuth false


DEBUG: SMTPTransport trying to connect to host "202.108.44.210", port 25


DEBUG SMTP RCVD: 220 Coremail SMTP(Anti Spam) System (163com[20050206])


DEBUG: SMTPTransport connected to host "202.108.44.210", port: 25


DEBUG SMTP SENT: EHLO lizongbo

DEBUG SMTP RCVD: 250-mx7
250-PIPELINING
250-AUTH LOGIN PLAIN NTLM
250-AUTH=LOGIN PLAIN NTLM
250 8BITMIME


DEBUG SMTP Found extension "PIPELINING", arg ""

DEBUG SMTP Found extension "AUTH", arg "LOGIN PLAIN NTLM"

DEBUG SMTP Found extension "AUTH=LOGIN", arg "PLAIN NTLM"

DEBUG SMTP Found extension "8BITMIME", arg ""

DEBUG SMTP: use8bit false

DEBUG SMTP SENT: MAIL FROM:<lizongbo@gmail.com>

DEBUG SMTP RCVD: 250 Ok


DEBUG SMTP SENT: RCPT TO:<li_zongbo@163.com>

DEBUG SMTP RCVD: 250 Ok


Verified Addresses

li_zongbo@163.com

DEBUG SMTP SENT: DATA

DEBUG SMTP RCVD: 354 End data with <CR><LF>.<CR><LF>


DEBUG SMTP SENT:

.

DEBUG SMTP RCVD: 250 Ok: queued as NkBMWIV9KUKqYBoE.1


DEBUG SMTP SENT: QUIT


上一篇: javamail的几个实用知识点
下一篇: 关于TOMCAT APACHE整合后的servlet应用!

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:Junit FAQ(017)

下一篇:JAVA相关基础知识(4)