简体   繁体   English

MailSendException:失败的消息:com.sun.mail.smtp.SMTPSendFailedException

[英]MailSendException: Failed messages: com.sun.mail.smtp.SMTPSendFailedException

I try to send an email using javaMail, spring-boot and yahoo. 我尝试使用javaMail,spring-boot和yahoo发送电子邮件。 I got this SMTPSendFailedException and I don't know why. 我收到了此SMTPSendFailedException,但我不知道为什么。

Here a part of the exception: 这里是例外的一部分:

ErrorPageFilter: Forwarding to error page from request [/registration] due to exception [Failed messages: com.sun.mail.smtp.SMTPSendFailedException: 501 Syntax error in arguments
;
  nested exception is:
    com.sun.mail.smtp.SMTPSenderFailedException: 501 Syntax error in arguments
]
org.springframework.mail.MailSendException: Failed messages: com.sun.mail.smtp.SMTPSendFailedException: 501 Syntax error in arguments
;
  nested exception is:
    com.sun.mail.smtp.SMTPSenderFailedException: 501 Syntax error in arguments
; message exception details (1) are:
Failed message 1:
com.sun.mail.smtp.SMTPSendFailedException: 501 Syntax error in arguments
;
  nested exception is:
    com.sun.mail.smtp.SMTPSenderFailedException: 501 Syntax error in arguments

    at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:2203)
    at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:1694)
    at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1194)
    at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:433)
    at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:307)
    at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:296)
    at java.lang.Thread.run(Thread.java:745)
Caused by: com.sun.mail.smtp.SMTPSenderFailedException: 501 Syntax error in arguments

    at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:1703)
    ... 102 more
[2015-10-27 22:11:14.252] boot - 8407 DEBUG [http-nio-8080-exec-8] --- EndpointHandlerMapping: Looking up handler method for path /error
[2015-10-27 22:11:14.257] boot - 8407 DEBUG [http-nio-8080-exec-8] --- EndpointHandlerMapping: Did not find handler method for [/error]

The Email config properties, I use yahoo as host: 电子邮件配置属性,我使用yahoo作为主机:

spring.mail.host=smtp.mail.yahoo.com
spring.mail.port=465
spring.mail.username=*****@yahoo.com
spring.mail.password=*****
spring.mail.default-encoding=UTF-8
spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.ssl.enable=true

The part of the implementation which send the email; 发送电子邮件的实现部分;

@Autowired
JavaMailSender javaMailSender;


    String recipientAddress = XXXX.getUser().getEmail();
    String subject = "Bienvenue chez AAAA";
    String message = "huhuu";
    SimpleMailMessage email = new SimpleMailMessage();
    email.setTo(recipientAddress);
    email.setSubject(subject);
    email.setText(message + "\n");
    javaMailSender.send(email);

Can someone help me? 有人能帮我吗?

What version of JavaMail are you using? 您正在使用哪个版本的JavaMail? Can you capture the debug output ? 您可以捕获调试输出吗? The mail server is complaining about the SMTP MAIL FROM command, which probably means the From address of your message isn't set correctly. 邮件服务器抱怨SMTP MAIL FROM命令,这可能意味着邮件的“发件人”地址设置不正确。 Since you don't seem to be setting it explicitly, perhaps SimpleMailMessage is choosing a default that's bad? 由于您似乎没有明确设置它,因此SimpleMailMessage可能选择了不好的默认值? Setting it explicitly to a legal value will probably solve the problem. 将其显式设置为合法值可能会解决该问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 com.sun.mail.smtp.SMTPSendFailedException Javamail - com.sun.mail.smtp.SMTPSendFailedException Javamail com.sun.mail.smtp.SMTPSendFailedException:530 5.7.1客户端未通过身份验证 - com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.1 Client was not authenticated com.sun.mail.smtp.SMTPSendFailedException: 550 5.2.125 发件人已超过允许发送的最大邮件数 - com.sun.mail.smtp.SMTPSendFailedException: 550 5.2.125 The sender has exceeded the maximum number of messages they are allowed to send 如何解决com.sun.mail.smtp.SMTPSendFailedException在Java中? - how to solve com.sun.mail.smtp.SMTPSendFailedException in java ? com.sun.mail.smtp.SMTPSendFailedException:530-5.5.1需要身份验证(Java Mail) - com.sun.mail.smtp.SMTPSendFailedException: 530-5.5.1 Authentication Required (Java Mail) Spring Boot 邮件发件人错误:com.sun.mail.smtp.SMTPSendFailedException - Error at Spring Boot mail sender: com.sun.mail.smtp.SMTPSendFailedException com.sun.mail.smtp.SMTPSendFailedException:452 4.4.5磁盘空间不足; 稍后再试 - com.sun.mail.smtp.SMTPSendFailedException: 452 4.4.5 Insufficient disk space; try again later 错误:com.sun.mail.smtp.SMTPSendFailedException:451 4.3.0 错误:队列文件写入错误 - Error: com.sun.mail.smtp.SMTPSendFailedException: 451 4.3.0 Error: queue file write error 如何解决 com.sun.mail.smtp.SMTPSendFailedException:554 Email 被拒绝 - How to resolve com.sun.mail.smtp.SMTPSendFailedException: 554 Email rejected com.sun.mail.smtp.SMTPSendFailedException:541 5.4.1 内容被内部防火墙阻止 - com.sun.mail.smtp.SMTPSendFailedException: 541 5.4.1 Content blocked by Internal Firewall
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM