SQL Server sp_send_dbmail - How to send mail in Gmail?

I use sp_send_dbmail , which works fine except when I send to recipients using Gmail accounts. The database mail log gives 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 non-Gmail recipients receive mail correctly.

When I use Outlook manually to send messages to these Gmail accounts, it works. Recipients correctly receive messages. SQL Server email account does not use Gmail. I use port 25 and SSL (I tried without SSL, and it doesn't work either).

The following is 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'; 
+5
source share
1 answer

I tested the sp_send_dbmail process in SSMS and it works great for gmail. In the message bar, I received the message "Mail queued". You can start firing from the queue using: msdb..sysmail_help_queue_sp @queue_type = 'Mail' ;

for me this seems like a smtp mail relay problem. You should also check your DB mail profile setting.

+1
source

All Articles