Code Optimization

Interesting things about software development and code optimization

Gmail G Suite as SMTP server for your website

Hello friends!

Its time to share so non obviouse case as using G Suite Gmail account and SMTP server to send emails from your website.

(it seems different than using private Gmail account)

Check restrictions and rules google uses for such sending emails scheme

First step and the most time consuming is to Enable less secure applications!

Go to the G Suite Admin > Security > Less secure apps 

and enable "Allow users to manage their access to less secure apps"

Pay attention - it really may take up to 24 hours before you see this "Less secure" option available 

While you are waiting you can do some other steps.

Go to the gmail account you are going to use and click on the top-right settings icon:

and select "Settings". Go to the POP/IMAP tab and enable POP and IMAP Access options.

Next step - add an SMTP Relay rule to allow your email accounts be accessible from outside:

G Suite Admin > Apps > G Suite > Gmail > Advanced Settings > SMTP relay service

Hover over this section and click the Add button. 

Add the following rule:

Wait some time until this option is available under the G Suite Gmail (email) account and turn it on:

Final step - use the following mail configuration in your website:

      <smtp from="">
        <network host="" port="587" enableSsl="true" userName="" password="pppaaassswwwooorrrddd" />
</smtp> </mailSettings> </>

That's it! Now you can send emails :)

Thank you and see you soon!