我尝试使用:sp_send_dbmail
但我收到以下错误:
Msg 15281,Level 16,State 1, Procedure sp_send_dbmail,Line 0 SQL Server blocked access to procedure ‘dbo.sp_send_dbmail’ of component ‘Database Mail XPs’ because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of ‘Database Mail XPs’ by using sp_configure. For more information about enabling ‘Database Mail XPs’,see “Surface Area Configuration” in SQL Server Books Online.
我还尝试使用此代码在SQL Server 2008 R2 EXPRESS中发送SMTP邮件: http://www.freevbcode.com/ShowCode.asp?ID=6699
但我收到以下错误:
Msg 15281, Procedure sp_OACreate,Line 1 SQL Server blocked access to procedure ‘sys.sp_OACreate’ of component ‘Ole Automation Procedures’ because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of ‘Ole Automation Procedures’ by using sp_configure. For more information about enabling ‘Ole Automation Procedures’,see “Surface Area Configuration” in SQL Server Books Online.
我去了“Facets”检查那里的安全选项,但没有关于“表面区域配置”的内容!是不是因为我使用的是SQL Server 2008 R2的Express版本?还是我朝错误的方向走?
如果您有任何更好的代码/建议在SQL Server 2008中发送邮件,请告诉我.谢谢!
解决方法
第1阶段:右键单击ssms上的sql server 2008r2 express /选择facets /选择Surface Area Configuration / set DatabaseMailEnabled – > true / click ok.Restart服务器
阶段2: 您只需要在msdb中配置一些表.这些是需要配置的表:
> sysmail_account – >创建默认邮件帐户 > sysmail_profile – >创建一个默认配置文件(sp_send_dbmail需要这个) > sysmail_profileaccount – >根据2个配置文件ID将相关数据添加到此 > sysmail_server – >从您将用于发送电子邮件的电子邮件帐户创建邮件服务器.如果您不知道服务器类型,请查看sysmail_servertype内部.
更新这些表后刷新msdb并尝试使用sp_send_dbmail发送电子邮件 如果您按照所有这些步骤操作,则可以使用sp_send_dbmail在sql 2008 r2 express中发送电子邮件. 我做了5次测试,但进展顺利.
Talley Ouro罗利talleyouro@hotmail.com (编辑:李大同)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|