我对“来自”地址的电子邮件服务有疑问.我想显示一个名字,说XYZ而不是XYZ@abc.com.我试着让它有一个字符串“XYZ”,但我收到了mailsend异常.
mailService.sendMail{
from "XYZ"
to "abc@123.com"
subject "HI"
body "How ru?"
}
例外情况是:
org.springframework.mail.MailSendException:
Failed messages: com.sun.mail.smtp.SMTPSendFailedException:
553 5.5.4 <XYZ>... Domain name required for sender address XYZ.
有没有办法在邮件的coloumn中有别名而不是地址?
谢谢.
解决方法:
完全猜测,但如果你这样做,它是否有效:
mailService.sendMail{
from "XYZ <XYZ@abc.com>"
to "abc@123.com"
subject "HI"
body "How ru?"
}