记录一下脑残的错误,在实现网页用户注册后,注册邮件的发送时报错,卡住了两天一直怀疑是代码错误,下面是报错:
Caused by: javax.mail.MessagingException: Can't send command to SMTP host;
nested exception is:
java.net.SocketException: Software caused connection abort: socket write error
或者是
javax.mail.AuthenticationFailedException: 535 Error: authentication failed
其实是邮箱的发送者或者接受者的名字写错了,下面是自定义的Mail工具类,
import javax.mail.Authenticator;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import javax.mail.