第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

使用JavaMail出現(xiàn)的異常

使用JavaMail出現(xiàn)的異常

海綿寶寶撒 2019-04-11 18:15:42
用的是163郵箱,授權(quán)已開,在使用JavaMail發(fā)郵件,每天開始的幾封能正常發(fā)送出去,后面會(huì)出現(xiàn)以下異常:源碼是:package test.ceshi; import java.io.File; import java.io.IOException; import java.util.Properties; import javax.mail.Authenticator; import javax.mail.Message.RecipientType; 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.MimeBodyPart; import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMultipart; public class MailTest {     public static void main(String[] args) throws AddressException, MessagingException, IOException {         Properties pro = new Properties();         pro.put("mail.smtp.host", "smtp.163.com");         pro.put("mail.smtp.auth", "true");         //pro.setProperty("mail.smtp.starttls.enable", "true");         Authenticator auth = new Authenticator() {             @Override             protected PasswordAuthentication getPasswordAuthentication() {                 return new PasswordAuthentication("用戶名", "授權(quán)碼");             }         };         Session session = Session.getInstance(pro, auth);         MimeMessage msg = new MimeMessage(session);         msg.setFrom(new InternetAddress("我的郵箱"));         msg.setRecipients(RecipientType.TO, "發(fā)送給的郵箱");         msg.setSubject("我自己的郵件");         msg.setContent("我的郵件正文", "text/html;charset=utf-8");         Transport.send(msg);     } }上網(wǎng)查了方法把上述注釋打開則會(huì)出現(xiàn)以下異常:各種方法都試過了還是解決不了,求大神解答,謝謝!
查看完整描述

3 回答

?
楊__羊羊

TA貢獻(xiàn)1943條經(jīng)驗(yàn) 獲得超7個(gè)贊

看完log,顯示是Caused by: Connection closed by remote host
就是說是連接被遠(yuǎn)程host關(guān)閉了,所以就發(fā)送失敗了,至于關(guān)閉的原因就需要你去排查了。

查看完整回答
反對(duì) 回復(fù) 2019-05-14
  • 3 回答
  • 0 關(guān)注
  • 1177 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)