Log4j with SES or WorkMail

0

I have registered a domain "example.com" on Route53, the identity for this domain has been verified on SES, an organisation "example" has been created on WorkMail and a user "user@example.com" has been created and enabled on WorkMail. I'd like to use this user@example.com to send emails from Log4j using the email appender. My .xml property file is as follows:

<Appenders> <Console name="ConsoleAppender" target="SYSTEM_OUT"> <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n" /> </Console> <File name="FileAppender" fileName="application-${date:yyyyMMdd}.log" immediateFlush="false" append="true"> <PatternLayout pattern="%d{yyy-MM-dd HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/> </File> <SMTP> <name>EmailAppender</name> <subject>Error</subject> <to>recipient</to> <from>**user@example.com**</from> <smtpHost>**smtp.mail.us-east-1.awsapps.com**</smtpHost> <smtpPort>**465**</smtpPort> <ignoreExceptions>false</ignoreExceptions> <smtpUsername>**user**</smtpUsername> <smtpPassword>**********</smtpPassword> <smtpProtocol>smtps</smtpProtocol> <HtmlLayout charset="UTF-8" locationInfo="true" /> <ThresholdFilter level="ERROR"/> </SMTP> </Appenders>

However I get the following error message: ERROR Caught exception while sending e-mail notification.: javax.mail.AuthenticationFailedException: 535 Authentication credentials invalid javax.mail.AuthenticationFailedException: 535 Authentication credentials invalid

I'm having the hardest time trying to find what is missing in my configuration.

I've tried to create a SMTP gateway in WorkMail on port 465 with username and password the same as what I use for user@example.com on WorkMail, but I get an error message: Failed to connect to the SMTP gateway. Verify that your gateway configuration is correct and reachable from public network.

Finally I've also tried to obtain Amazon SES SMTP credentials using the SES console, and use them instead in my .xml above, but I still get the same error message.

At this point I've run out of ideas, any help much appreciated!

1 Answer
0

Hi,

I'm sorry to hear you're experiencing problems sending mail. WorkMail is a Business Email and Calendar Solution which is not intended to be used for automated mailing. SES is the solution to be used for that.

The error implies the authentication failed. Are you using the correct region end-point? The SES SMTP credentials are region bound.

Kind regards, Robin

AWS
EXPERT
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions