javamail程序中,输出提示成功了,但邮箱没有收到邮件
package com.vention1;import java.util.Properties;
import javax.mail.Address;
import javax.mail.Message;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
public class Demo1 {
public static void main(String[] args) throws Exception{
Properties props=new Properties();
props.setProperty("mail.smtp.auth","true");
props.setProperty("mail.transport.protocol", "smtp");
Session session=Session.getInstance(props);
session.setDebug(true);
Message msg=new MimeMessage(session);
msg.setText("为什么不行,求高手指点?");
msg.setFrom(new InternetAddress("jian@sina.com"));
Transport transport=session.getTransport();
transport.connect("smtp.sina.com",25,"vention1","32115113658904");
transport.sendMessage(msg, new Address[]{new InternetAddress("kffnwvf@163.com")});
transport.close();
}
}
输出提示:
DEBUG: setDebug: JavaMail version 1.4.5
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: trying to connect to host "smtp.sina.com", port 25, isSSL false
220 irja2-171.sinamail.sina.com.cn ESMTP
DEBUG SMTP: connected to host "smtp.sina.com", port: 25
EHLO 192.168.1.158
250-irja2-171.sinamail.sina.com.cn
250-8BITMIME
250-SIZE 73400320
250-AUTH PLAIN LOGIN
250 AUTH=PLAIN LOGIN
DEBUG SMTP: Found extension "8BITMIME", arg ""
DEBUG SMTP: Found extension "SIZE", arg "73400320"
DEBUG SMTP: Found extension "AUTH", arg "PLAIN LOGIN"
DEBUG SMTP: Found extension "AUTH=PLAIN", arg "LOGIN"
DEBUG SMTP: Attempt to authenticate
DEBUG SMTP: check mechanisms: LOGIN PLAIN DIGEST-MD5 NTLM
DEBUG SMTP: AUTH LOGIN command trace suppressed
DEBUG SMTP: AUTH LOGIN succeeded
DEBUG SMTP: use8bit false
MAIL FROM:<jian@sina.com>
250 sender <jian@sina.com> ok
RCPT TO:<kffnwvf@163.com>
250 recipient <kffnwvf@163.com> ok
DEBUG SMTP: Verified Addresses
DEBUG SMTP: kffnwvf@163.com
DATA
354 go ahead
From: jian@sina.com
Message-ID: <27994366.0.1338216916948.JavaMail.Administrator@OQKFMF2U6KSXVCC>
MIME-Version: 1.0
Content-Type: text/plain; charset=GBK
Content-Transfer-Encoding: quoted-printable
=C4=E3=BA=C3=C2=F0=A3=BFkffnwvsdfas
.
250 ok: Message 1255580763 accepted
QUIT
221 irja2-171.sinamail.sina.com.cn
--------------------编程问答-------------------- 还没研究过。帮忙顶下。 --------------------编程问答-------------------- --------------------编程问答--------------------
--------------------编程问答-------------------- Properties props = new Properties();
props.setProperty("mail.smtp.host","smtp.sina.com");
props.setProperty("mail.smtp.auth","true");
props.setProperty("mail.transport.protocol", "smtp");
props.setProperty("mail.host", "mailsv01.xxxxx.xx.xx");
props.setProperty("mail.user", "chen");
props.setProperty("mail.password", "xxxxxchen");
Session mailSession = Session.getDefaultInstance(props, null);
Transport transport = mailSession.getTransport();
MimeMessage mm = new MimeMessage(mailSession);
mm.addRecipients(RecipientType.TO, to);
mm.setSubject(title);
mm.setContent(body, "text/plain");
transport.connect();
transport.send(mm, mm.getRecipients(Message.RecipientType.TO));
transport.close();
--------------------编程问答-------------------- 改为3楼那样,还是不行。 --------------------编程问答-------------------- 你那发送邮箱开通smtp协议了没
补充:Java , Java相关