从java向Yahoo邮件发送电子邮件时,内部链接无法正常工作。 虽然在Gmail中可以使用,但在Yahoo中无法点击该网址。
以下是发送邮件的代码:
MimeMessage mime = this.mailSender.createMimeMessage();
MimeMessageHelper message = new MimeMessageHelper(mime, true);
message.setTo(to);
message.setSubject(subject);
message.setText("verification link: http://localhost:8080/myproject/verification.zulverId=6c1", true);
this.mailSender.send(mime);
答案 0 :(得分:1)
使用
message.setContent("verification link: http://localhost:8080/myproject/verification.zulverId=6c1", "text/html; charset=utf-8");
message.saveChanges();
setText在内部调用setContent方法。直接使用它。