I am using sp_send_dbmail
which is working perfectly except when I send to recipients using Gmail accounts. The database mail log give the following error:
Error,80,The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 2 (2015-05-29T13:22:39). Exception Message: Cannot send mails to mail server. (Unable to send to a recipient.))
All recipients not using Gmail receive the mail correctly.
When I use Outlook manually to send messages to this Gmail accounts it is working. The recipients receive the messages correctly. The SQL Server mail account is not using Gmail. I use Port 25 and SSL (I tried without SSL and it is not working either).
Here below the procedure call:
EXEC msdb.dbo.sp_send_dbmail
@recipients = 'somemail@company.com;somemail@gmail.com',
@copy_recipients = 'somemail@company.com',
@profile_name = 'my_profile',
@subject = 'mail subject',
@body = 'some content',
@body_format = 'Text';