简体   繁体   English

SQL Server sp_send_dbmail - 如何向Gmail发送邮件?

[英]SQL Server sp_send_dbmail - How to send mail TO Gmail?

I am using sp_send_dbmail which is working perfectly except when I send to recipients using Gmail accounts. 我正在使用sp_send_dbmail ,除非我使用Gmail帐户发送给收件人,否则它的工作正常。 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. 所有未使用Gmail的收件人都会正确收到邮件。

When I use Outlook manually to send messages to this Gmail accounts it is working. 当我手动使用Outlook向此Gmail帐户发送邮件时,它正在运行。 The recipients receive the messages correctly. 收件人正确收到邮件。 The SQL Server mail account is not using Gmail. SQL Server邮件帐户未使用Gmail。 I use Port 25 and SSL (I tried without SSL and it is not working either). 我使用端口25和SSL(我试过没有SSL,它也没有工作)。

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';

I tested the sp_send_dbmail proc in SSMS and it works fine for gmail. 我在SSMS中测试了sp_send_dbmail proc,它适用于gmail。 On the message panel, I got message 'Mail queued'. 在消息面板上,我收到消息“邮件排队”。 You may trouble shoot the queue using: msdb..sysmail_help_queue_sp @queue_type = 'Mail' ; 您可能无法使用以下msdb..sysmail_help_queue_sp @queue_type = 'Mail' ;对队列进行排队: msdb..sysmail_help_queue_sp @queue_type = 'Mail' ;

for me, it look like smtp mail relay issue. 对我来说,它看起来像smtp邮件中继问题。 You should also test you DB mail profile setup. 您还应该测试DB邮件配置文件设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM