Tested with Moodle 3.8 this document explains how to configure gmail and Moodle, so that you can use gmail credentials to send emails from moodle