我目前正在使用此脚本发送客户邮件。但我的收件箱中的“发件人”名称显示: fullhouseproject1@gmail.com。我想把这个名字设为Full House。我该怎么做?
public Mail(Speler speler) throws MessagingException {
final String username = "fullhouseproject1@gmail.com";
final String password = "password";
Properties props = new Properties();
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.smtp.host", "smtp.gmail.com");
props.put("mail.smtp.port", "587");
Session session = Session.getInstance(props,
new javax.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password);
}
});
Message message = new MimeMessage(session);
message.setFrom(new InternetAddress("Full House"));
message.setRecipients(Message.RecipientType.TO,
InternetAddress.parse(speler.email));
message.setSubject("Bevestiging van betaling " + "- Toernooi: " + speler.ToernooiID);
message.setText("Geachte heer/mevrouw " + speler.naam + ","
+ "\n\n Uw betaling voor toernooi: " + speler.ToernooiID + " is geaccepteerd."
+ "\n\n Met vriendelijke groet,"
+ "\n Full House");
Transport.send(message);
System.out.println("Done");
}
}
答案 0 :(得分:0)
message.setFrom(new InternetAddress("fullhouseproject1@gmail.com","Full House"));