发送邮件时出错:尝试以其访问权限禁止的方式访问套接字 [英] Error when sending mail : An attempt was made to access a socket in a way forbidden by its access permissions

查看:158
本文介绍了发送邮件时出错:尝试以其访问权限禁止的方式访问套接字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我目前正在尝试让sql server管理工作室db邮件工作,但我忍不住得到了"试图访问一个套接字被其访问权限禁止的方式"每当我尝试使用sp_send_dbmail
proc发送邮件时出错。



我实际上已经让它在我的开发环境中运行了。最困扰我的是我可以使用send-mailmessage命令在我的真实环境中使用windows powershell成功发送邮件:$ send-mailmessage -from" ...'-to
" ; ..." -subject" ..." -smtpServer" mySmtp" -port 25



在我的dbmail帐户中使用相同的参数,我无法发送邮件并得到上述错误。



现在,我只是通过调用程序进行测试:

   EXEC   msdb    dbo    sp_send_dbmail 
@ profile_name = 'myProfile'
@ 收件人 = 'myAddress'
@ 科目 = '测试' ;

这是我的SSMS配置:


产品:Microsoft SQL Server Standard(64位);操作系统:Microsoft NT 6.3(14393);平台:NT x64;版本:13.0.4001;在Windows Server 2016上运行。

解决方案

这几乎听起来像是防火墙问题。请检查您用于邮件的端口是否已启用数据库服务器上防火墙的出站通信。



使用此问题排查工具进一步了解。


http://www.midnightdba.com/DBARant/complete-troubleshooting-guide-for-sql-server-databasemail-dbmail/


I am currently trying to get the sql server management studio db mail to work, but i can't help but get the "An attempt was made to access a socket in a way forbidden by its access permissions" error whenever I try to send a mail using the sp_send_dbmail proc.

I actually already made it work on my dev environment. And the thing that bothers me the most is that I can successfully send a mail using windows powershell in my real environment, with the send-mailmessage command : $ send-mailmessage -from "...' -to "..." -subject "..." -smtpServer "mySmtp" -port 25

And with the same parameters in my dbmail account, I fail to send the mail and get the mentioned error.

For now, I'm doing my tests simply by calling the procedure :

EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'myProfile',
@recipients = 'myAddress',
@subjects = 'test';

Here is my SSMS config :

Product : Microsoft SQL Server Standard (64-bit); Operating System : Microsoft NT 6.3 (14393); Platform : NT x64; Version : 13.0.4001; running on Windows Server 2016.

解决方案

This almost sounds like a firewall issue. Check that the port you are using for mail is enabled for outbound communication on the firewall on the database server.

Use this troubleshooter to figure it out further.

http://www.midnightdba.com/DBARant/complete-troubleshooting-guide-for-sql-server-databasemail-dbmail/


这篇关于发送邮件时出错:尝试以其访问权限禁止的方式访问套接字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆