Thursday, 2 August 2018

Is You Custom SMTP Connection Not Working in Sitecore EXM?

Most of times you follow Sitecore official documentation or community blog posts to use several features of Sitecore. But even-though after following all instructions very carefully, you end up in a unpleasant situation where the configured feature/functionality is not working.

So are you in same situation where you tried to configure Sitecore Email Experience Manager (EXM) with custom SMTP connection but still you are facing error in Test Connection?



First of all check the logs in Eds.* file to get more details where exactly the connection problem is.


In my case, below lines in log file were game changer. It gave me instant strike that my gmail account is configured for second step verification hence I was not able to connect Sitecore EXM with my custom gmail SMTP details. This could be a case with you also and that's why I wrote this post - to help you friends who caught in the same boat.

readSmtpResponse:
SmtpCmdResp: 534-5.7.9 Application-specific password required. Learn more at
SmtpCmdResp: 534 5.7.9  https://support.google.com/mail/?p=InvalidSecondFactor a5- v6sm1673474wmf.3 - gsmtp

So how to fix this? You would say remove second factor verification from Gmail, right? 
Well, we developer always do everything to allow our application to run :), isn't it? No, we are not going to remove second step verification from Gmail and will fix the connection issue instead.

Here are the steps:
1. Login to your Gmail account
2. Navigate to https://security.google.com/settings/security/apppasswords
3. In 'select app' choose 'custom', give it an random name and press generate button
4. It will generate 16 chars token.


Now copy that 16 character token and replace it with your "password" under SMTP \App_Config\Sitecore\EmailExperience\Sitecore.EDS.Providers.CustomSMTP.config file



That's it, try to test EXM connection and it should work now.