发送电子邮件的代码如下:
MimeMessage msg = new MimeMessage(session);
msg.setSubject("subject", "UTF-8"); // here you specify your subject encoding
msg.setContent("yourBody", "text/plain; charset=utf-8");
msg.setFrom("senderAddress");
msg.addRecipient(Message.RecipientType.TO, new InternetAddress(address));
Transport.send(msg);
我的问题是,当我在 utf-8 中编码主题时,我如何编码收件人地址,即。new InternetAddress(address)