新配置的SQLServer 2016 数据库,配置好数据库邮件后,无法发送测试邮件,也没有日志:
相关检查也都正常,没有问题:
--查看DB Mail 队列状态
EXEC msdb.dbo.sysmail_help_queue_sp
--查看DB Mail 是否启动:
EXEC msdb.dbo.sysmail_help_status_sp
--查看发送和未发送的邮寄
SELECT * FROM msdb.dbo.sysmail_sentitems;
SELECT * FROM msdb.dbo.sysmail_unsentitems;
--查看service broker是否启动:
SELECT is_broker_enabled FROM sys.databases WHERE name = 'msdb';
在官方查到一个说明:
To work around this issue, you can implement any one of the following:
1.Create the DatabaseMail.exe.config and drop it next to the DatabaseMail.exe under the Binn folder. You can use notepad.exe or any other editor to edit it. Just make sure you save it by using UTF-8 encoding (in notepad.exe, select Save As... and in the Encoding combo box, select UTF-8):
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0"/>
<supportedRuntime version="v2.0.50727"/>
</startup>
</configuration>
1. Run a repair setup action of SQL Server 2016.
2.Manually install .Net Framework 3.5 on the machine.
因为数据库已经上线。所有跳过修改的过程,直接创建文件。 在以下目录:
D:/Program Files/Microsoft SQL Server/MSSQL13.MSSQLSERVER/MSSQL/Binn
创建了文件:DatabaseMail.exe.config,添加如下内容:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0"/>
<supportedRuntime version="v2.0.50727"/>
</startup>
</configuration>
然后重启了DB Mail,邮件发送正常:
--重启DB mail:
USE msdb;
EXEC sysmail_stop_sp;
EXEC sysmail_start_sp;
版权声明:本文为博主原创文章,未经博主允许不得转载。