For a small volume of emails to send as a personal purpose or for a small business, it can be handy to use Google SMTP service as long as you have a Google account.
It sounds easy task but sometimes it can be tricky if configuration is not properly written and the error message from the Google SMTP is not straightfoward to interpreat what has happened.
Here is the sample NLog config set up to use Google SMTP.
<target name="email" xsi:type="Mail"
subject="This is a test Email"
smtpPassword="app password obtain from Google"
A few points confused me are
- smtpPort should be 465
- User name your google email address
- Password is Google App Password, which is different from the general Google account password. You can created one following the document.
Thank you very much, it works