Database is another executable DatanaseMail.exe that invoked by SQL server.
This is the quick work through for how to enable SQL server database mail with Gmail .
First, we need to enable the database mail in the SQL server.
We now need to create the profile.
This link https://support.google.com/a/answer/176600?hl=en outline how to setup the smtp server for gmail. Base on my testing, we have to use port 587 and user name must be the full email address ( including gmail.com)
Above steps can be replaced with the SQL below
Query msdb.dbo.sysmail_account to list all the current email accounts.
Above Steps can be created via SQL as below
After profile is created, we can check msdb.dbo.sysmail_profile
We can send the test email .
Alternatfully , we can use the sp_send_mail to test as well.
- sysmail_log : list the high level of the database mail event.
- sysmail_allitems: store each eamil’s detail
- sysmail_configuration: store configuration for the mail