Search code examples
javaamazon-web-servicesspring-bootsmtpamazon-ses

AWS SES Warning: Mail health check failed


We are developing a Java Spring Boot application on AWS and using SES as SMTP server.

When the application starts up (it's a Docker container running into an ECS Task) We receive the following warning in CloudWatch.

{
    "timestamp": "2023-05-30T15:57:28.7Z",
    "logger": "org.springframework.boot.actuate.mail.MailHealthIndicator",
    "level": "WARN",
    "thread": "http-nio-8080-exec-4",
    "stackTrace": "javax.mail.MessagingException: 501 Syntax: HELO <hostname>\n\n\tat com.sun.mail.smtp.SMTPTransport.issueCommand(SMTPTransport.java:2324)\n\tat com.sun.mail.smtp.SMTPTransport.helo(SMTPTransport.java:1678)\n\tat .. truncated ...,
    "message": "Mail health check failed",
    "exceptionClass": "MessagingException"
}

I've searched online but can't find the root cause of this issue.

Have you got any suggestion?

Thanks.


Solution

  • I'd double check those metrics, as this might mean your SES Email Acount is unhealthy because your bounce and complaints rates are too high, which might effectively block you from sending any emails.

    From the docs:

    Amazon SES actively tracks several metrics that may cause your reputation as a sender to be damaged, or that could cause your email delivery rates to decline. Two important metrics that we consider in this process are the bounce and complaint rates for your account.

    Bounce – A hard bounce that the recipient's mail server permanently rejected the email. (Soft bounces are only included when Amazon SES fails to deliver the email after retrying for a period of time.)

    Complaint – The email was successfully delivered to the recipient’s mail server, but the recipient marked it as spam.

    Also, make sure your emails are not being send to an email spam trap.

    To learn more about monitoring your Amazon SES sender reputation, read this.