Configure smtp enable ssl in sitecore 9 and above in sitecore config

Prem Murmu on 2/26/2021 9:59:16 PM

I was trying to setting email funcitonality in sitecore 9.1 and but i was unable to figureout. I got below error.

Error:
Message = "The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Must issue a STARTTLS command first. t6sm12609040qti.2 - gsmtp".

It was clear that i had to enable ssl in smtp client in email functionality core or in any config in sitecore. Once i tried to configure enable ssl in web config like normal .Net project.

Ex.

<system.net>

  <mailSettings>

    <smtp deliveryMethod="Network">

      <network enableSsl="true" />

    </smtp>

  </mailSettings>

</system.net>

It didnt work.

Next I went across some articles and got idea to configure Enable SSL in sitecore.config with other mail sending configuration. 

I just added one more setting node name "MailServerUseSsl" and its value "true"  for enable ssl in sitecore.config file like below:

<!--  MAIL SERVER

SMTP server used for sending mails by the Sitecore server

Is used by MainUtil.SendMail()

Default value: ""

-->

<setting name="MailServer" value="smtp.gmail.com" />

<!--  MAIL SERVER USER

If the SMTP server requires login, enter the user name in this setting

-->

<setting name="MailServerUserName" value="abc16@gmail.com" />

<!--  MAIL SERVER PASSWORD

If the SMTP server requires login, enter the password in this setting

-->

<setting name="MailServerPassword" value="abcpass@16" />

<!--  MAIL SERVER PORT

If the SMTP server requires a custom port number, enter the value in this setting.

The default value is: 25

-->

<setting name="MailServerPort" value="587" />

<!--  MAIL SERVER SSL

If the SMTP server requires to secure a connection, need to enable ssl.

-->

<setting name="MailServerUseSsl" value="true"/>


After adding this to sitecore config, i recycle to application pool of project and finally email sending funcitonality worked.


References:

1.https://stackoverflow.com/questions/17462628/the-server-response-was-5-7-0-must-issue-a-starttls-command-first-i16sm1806350

2.https://www.jondjones.com/learn-sitecore-cms/sitecore-developers-guide/how-to-configure-sitecore/how-to-configure-smtp-details-in-sitecore/

3.https://sitecoretweaks.wordpress.com/2019/06/19/ enable-ssl-for-sending-emails-on-sitecore-9/

0 Comments on this post

Comments(0)||Login to Comments


InterServer Web Hosting and VPS
  • see more..