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

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Java發(fā)送郵件老是報這錯,怎么解決?

Java發(fā)送郵件老是報這錯,怎么解決?

UYOU 2019-02-24 03:13:20
javax.mail.AuthenticationFailedException: 530 Error: A secure connection is requiered(such as ssl) Properties prop = new Properties(); prop.setProperty("mail.transport.protocol", "smtp"); // 設置郵件發(fā)送協(xié)議 prop.setProperty("mail.host", "smtp.qq.com"); // 郵件服務器地址 //prop.setProperty("mail.smtps.ssl.enable", "true"); // 郵件ssl驗證 prop.setProperty("mail.smtp.auth", "true"); // 郵件服務身份驗證 //prop.setProperty("mail.smtp.localhost", "127.0.0.1"); Session session = Session.getDefaultInstance(prop); // 收件人電子郵箱 String to = "xxxxx@qq.com"; // 發(fā)件人電子郵箱 String from = "xxxx@qq.com"; try{ // 創(chuàng)建默認的 MimeMessage 對象 MimeMessage message = new MimeMessage(session); // Set From: 頭部頭字段 message.setFrom(new InternetAddress(from)); // Set To: 頭部頭字段 message.addRecipient(Message.RecipientType.TO, new InternetAddress(to)); // Set Subject: 頭部頭字段 message.setSubject("This is the Subject Line!"); // 設置消息體 message.setText("This is actual message"); // 根據(jù) Session 獲取郵件傳輸對象 Transport transport = session.getTransport(); transport.connect("xxx@qq.com","xxxxx"); // 發(fā)送消息 transport.send(message); System.out.println("Sent message successfully...."); }catch (MessagingException mex) { mex.printStackTrace(); }
查看完整描述

1 回答

?
喵喔喔

TA貢獻1735條經驗 獲得超5個贊

服務器要求加密,你卻注釋掉了

 //prop.setProperty("mail.smtps.ssl.enable", "true"); // 郵件ssl驗證
查看完整回答
反對 回復 2019-03-01
  • 1 回答
  • 0 關注
  • 374 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號