sql-server - 通过 SQL Server 发送电子邮件失败

标签 sql-server sql-server-2008 sql-server-2005

我正在 SQL Server 2008 中设置数据库邮件,以将邮件发送到我的 Gmail 帐户。以下是我创建的 DBMail 配置文件的详细信息:

email id : xyz@gmail.com
Display Name : xyz
Reply email :
Server name : smtp.gmail.com
port no: 587
Check : This server requires a secure connection
Check : Basic Authentication
username : xyz@gmail.com ( should have gmail.com)
password : <mypassword>
confirm password : <mypassword>

然后我单击“下一步”,并将其设为默认公开个人资料。

然后我使用以下 TSQL 代码来配置和发送 DBMail:

EXEC sp_CONFIGURE 'show advanced', 1
GO
RECONFIGURE
GO
EXEC sp_CONFIGURE 'Database Mail XPs', 1
GO
RECONFIGURE
GO

use msdb
go
EXEC sp_send_dbmail 
@profile_name='XYZ',
@recipients='XYZr@gmail.com',
@subject='Test message',
@body='Message Sent Successfully'

The output appears "Message Queued"

我的消息仍然失败。我觉得我已经正确设置了服务器。任何意见将不胜感激。

 SELECT * FROM sysmail_log

正文栏显示

"The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 1 (2012-05-16T17:05:00). Exception Message: Could not connect to mail server. (No such host is known). )"

最佳答案

一些建议的故障排除步骤:

  1. 尝试使用 SQL Server 所在的同一台计算机,使用 Outlook 等客户端邮件程序,通过同一 SMTP 服务器发送消息。您可能会收到更有意义的错误消息。

  2. 端口可能被阻止。尝试使用端口 587 将邮件发送到任何其他 SMTP 服务器。

  3. 尝试更改为端口 465。

  4. 尝试取消选中您的个人资料中的“需要安全连接”部分。

  5. 尝试使用网络内的 SMTP 服务器中继到 GMail。这可能更容易设置和运行。如果没有可用于处理中继的本地 SMTP 服务器,则需要安装 IIS 和 SMTP 组件。

  6. 评论 http://mail.google.com/support/bin/answer.py?hl=en&answer=13287

关于sql-server - 通过 SQL Server 发送电子邮件失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10626926/

相关文章:

sql-server - 如何在sql server中的所有节点中添加XML节点

c# - 如何在 ASP.NET 中处理 KeyPress 或 KeyDown 事件?

java - 从SQL Server 2005升级到SQL Server 2008,JAVA应用程序会出现错误吗?

sql - 在大型 XML 集上使用 HASHBYTES

sql - SQL Server 2008 中的内连接删除?

sql-server - 如何列出两个日期之间的所有日期

SQL 查询 - 根据条件对连续项目进行分组

c++ - 如何在 C++ 中使用 smo 库

c# - 使用 TransactSQL 将字节数组转换为字符串

sql - SSRS 2008 R2 : An expression of non-boolean type specified in a context where a condition is expected, 附近 ','