Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
单击重置密码时,我想向收件人发送邮件。邮件发送正确,但发件人地址类似于 myname@SystemName 如何设置发件人地址?
使用 setFrom() 方法:
Session mailSession = Session.getInstance(props, null); MimeMessage message = new MimeMessage(mailSession); message.setFrom(new InternetAddress("sendingaddress@company.com"));
JavaDoc 参考