Surendra Sharma

Surendra Sharma

Search This Blog

Showing posts with label sendgrid. Show all posts
Showing posts with label sendgrid. Show all posts

Monday, March 15, 2021

Sitecore forgot password configuration with Sendgrid

Recently I worked on forgot password functionality from where user can get new password in his inbox through SendGrid in case if he forgot the Sitecore login password.

My Sitecore instance is on Azure. 

Open Kudu

I create a patch file at \site\wwwroot\App_Config\Include\zzz\MyPatchFile.config file and in <settings> section add below SMTP details lines.

<setting name="MailServer" value="smtp.sendgrid.net" />

<setting name="MailServerUserName" value="apikey" />

<setting name="MailServerPassword" value="4565655676hkjsd7868jkhkj" />

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


Save your changes.

If you are using SSL security, you must also add the following setting to the configuration file \site\wwwroot\Web.config:


  <system.net>

    <mailSettings>

      <smtp from="noreply@example.com">

        <network host="smtp.sendgrid.net" password="4565655676hkjsd7868jkhkj" userName="apikey" port="587" />

      </smtp>

    </mailSettings>

  </system.net>

</configuration>

 
Save your changes.

You need to change the sender of the Forgot your Password email to a valid email address. You can also edit the subject and content of the email. To do this, follow these steps:

  • Log in to Sitecore as an administrator.
  • In the Launchpad, open the Desktop, and select the Core database.
  • In the Content Editor, navigate to /sitecore/system/Settings/Security/Password recovery/Password Recovery Email.
  • Enter a valid email address in the Sender email address field, and change the other fields as you need.

Sitecore Forgot Password configuration

Now if any user forgot his password, 

  • Visit to /sitecore/login page. 
  • Click on "Forgot your password?"
  • Enter Sitecore user name
  • Click on Send button

You should receive a email with username with newly generated password.