当前位置: 技术问答>java相关
javamail有一些新问题,高手们解决了一定会给分你们的。
来源: 互联网 发布时间:2015-11-15
本文导语: 在发邮件的时候出现下列问题,老是不能解决,希望大家能帮帮我这个出道“小子”,我对javamail了解不多,但不知道为什么网上介绍的都有点出入,我就没有办法了。只好贡献分数问大家了。:) DEBUG: setDebug: Java...
在发邮件的时候出现下列问题,老是不能解决,希望大家能帮帮我这个出道“小子”,我对javamail了解不多,但不知道为什么网上介绍的都有点出入,我就没有办法了。只好贡献分数问大家了。:)
DEBUG: setDebug: JavaMail version 1.3
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.s
mtp.SMTPTransport,Sun Microsystems, Inc.,1.3]
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.s
mtp.SMTPTransport,Sun Microsystems, Inc.,1.3]
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: useEhlo true, useAuth true
DEBUG: SMTPTransport trying to connect to host "smtp.21cn.com", port 25
DEBUG SMTP RCVD: 220 21cn.com SMTP Server of AIMC 2.9.5.2 (A).
DEBUG: SMTPTransport connected to host "smtp.21cn.com", port: 25
DEBUG SMTP SENT: EHLO gzoyy
DEBUG SMTP RCVD: 250-21cn.com, helo (DELAYED)
250-EXPN
250-HELP
250-8BITMIME
250-AUTH=LOGIN PLAIN
250-AUTH LOGIN PLAIN
250 XTMD
DEBUG SMTP Found extension "EXPN", arg ""
DEBUG SMTP Found extension "HELP", arg ""
DEBUG SMTP Found extension "8BITMIME", arg ""
DEBUG SMTP Found extension "AUTH=LOGIN", arg "PLAIN"
DEBUG SMTP Found extension "AUTH", arg "LOGIN PLAIN"
DEBUG SMTP Found extension "XTMD", arg ""
DEBUG SMTP: Attempt to authenticate
DEBUG SMTP SENT: AUTH LOGIN
DEBUG SMTP RCVD: 334 VXNlcm5hbWU6
DEBUG SMTP SENT: emhpZ3VvbGFp
DEBUG SMTP RCVD: 334 UGFzc3dvcmQ6
DEBUG SMTP SENT: Y2hpbmFhc3A=
DEBUG SMTP RCVD: 235 OK Authenticated
DEBUG SMTP: use8bit false
DEBUG SMTP SENT: MAIL FROM:
DEBUG SMTP RCVD: 250 , sender ok.
DEBUG SMTP SENT: RCPT TO:
DEBUG SMTP RCVD: 250 , Local recipient ok.
Verified Addresses
yyyy@21cn.com
DEBUG SMTP SENT: DATA
DEBUG SMTP RCVD: 354 Start mail input; end with .
javax.activation.UnsupportedDataTypeException: no object DCH for MIME type text/
plain; charset=us-ascii
at javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:84
1)
at javax.activation.DataHandler.writeTo(DataHandler.java:295)
at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1147)
at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1600)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:324)
at javax.mail.Transport.send0(Transport.java:163)
at javax.mail.Transport.send(Transport.java:80)
at _cc__jsp._jspService(_cc__jsp.java:77)
at com.caucho.jsp.JavaPage.service(JavaPage.java:74)
at com.caucho.jsp.Page.subservice(Page.java:485)
at com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:
181)
at com.caucho.server.http.Invocation.service(Invocation.java:291)
at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:1
32)
at com.caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java
:341)
at com.caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.j
ava:271)
at com.caucho.server.TcpConnection.run(TcpConnection.java:136)
at java.lang.Thread.run(Thread.java:484)
DEBUG: setDebug: JavaMail version 1.3
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.s
mtp.SMTPTransport,Sun Microsystems, Inc.,1.3]
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.s
mtp.SMTPTransport,Sun Microsystems, Inc.,1.3]
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: useEhlo true, useAuth true
DEBUG: SMTPTransport trying to connect to host "smtp.21cn.com", port 25
DEBUG SMTP RCVD: 220 21cn.com SMTP Server of AIMC 2.9.5.2 (A).
DEBUG: SMTPTransport connected to host "smtp.21cn.com", port: 25
DEBUG SMTP SENT: EHLO gzoyy
DEBUG SMTP RCVD: 250-21cn.com, helo (DELAYED)
250-EXPN
250-HELP
250-8BITMIME
250-AUTH=LOGIN PLAIN
250-AUTH LOGIN PLAIN
250 XTMD
DEBUG SMTP Found extension "EXPN", arg ""
DEBUG SMTP Found extension "HELP", arg ""
DEBUG SMTP Found extension "8BITMIME", arg ""
DEBUG SMTP Found extension "AUTH=LOGIN", arg "PLAIN"
DEBUG SMTP Found extension "AUTH", arg "LOGIN PLAIN"
DEBUG SMTP Found extension "XTMD", arg ""
DEBUG SMTP: Attempt to authenticate
DEBUG SMTP SENT: AUTH LOGIN
DEBUG SMTP RCVD: 334 VXNlcm5hbWU6
DEBUG SMTP SENT: emhpZ3VvbGFp
DEBUG SMTP RCVD: 334 UGFzc3dvcmQ6
DEBUG SMTP SENT: Y2hpbmFhc3A=
DEBUG SMTP RCVD: 235 OK Authenticated
DEBUG SMTP: use8bit false
DEBUG SMTP SENT: MAIL FROM:
DEBUG SMTP RCVD: 250 , sender ok.
DEBUG SMTP SENT: RCPT TO:
DEBUG SMTP RCVD: 250 , Local recipient ok.
Verified Addresses
yyyy@21cn.com
DEBUG SMTP SENT: DATA
DEBUG SMTP RCVD: 354 Start mail input; end with .
javax.activation.UnsupportedDataTypeException: no object DCH for MIME type text/
plain; charset=us-ascii
at javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:84
1)
at javax.activation.DataHandler.writeTo(DataHandler.java:295)
at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1147)
at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1600)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:324)
at javax.mail.Transport.send0(Transport.java:163)
at javax.mail.Transport.send(Transport.java:80)
at _cc__jsp._jspService(_cc__jsp.java:77)
at com.caucho.jsp.JavaPage.service(JavaPage.java:74)
at com.caucho.jsp.Page.subservice(Page.java:485)
at com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:
181)
at com.caucho.server.http.Invocation.service(Invocation.java:291)
at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:1
32)
at com.caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java
:341)
at com.caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.j
ava:271)
at com.caucho.server.TcpConnection.run(TcpConnection.java:136)
at java.lang.Thread.run(Thread.java:484)
|
我的源代码为下面两大段,希望各位高手给于意见和解决。。。谢谢。
附上一个类SmtpAuth
import java.util.Date;
import java.util.*;
import java.util.Hashtable;
import javax.activation.DataHandler;
import javax.activation.FileDataSource;
import javax.mail.*;
import javax.mail.internet.*;
public class SmtpAuth extends javax.mail.Authenticator{
private String user,password;
public void getuserinfo(String getuser,String getpassword){
user=getuser;
password=getpassword;
}
protected javax.mail.PasswordAuthentication getPasswordAuthentication(){
return new javax.mail.PasswordAuthentication(user,password);
}
}
附上一个类SmtpAuth
import java.util.Date;
import java.util.*;
import java.util.Hashtable;
import javax.activation.DataHandler;
import javax.activation.FileDataSource;
import javax.mail.*;
import javax.mail.internet.*;
public class SmtpAuth extends javax.mail.Authenticator{
private String user,password;
public void getuserinfo(String getuser,String getpassword){
user=getuser;
password=getpassword;
}
protected javax.mail.PasswordAuthentication getPasswordAuthentication(){
return new javax.mail.PasswordAuthentication(user,password);
}
}