使用SQL Server发送邮件时出错 [英] Error while sending mail using SQL server
本文介绍了使用SQL Server发送邮件时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用sql server发送
错误是
I want to send using sql server
Error is
The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 6 (2017-09-07T14:01:30). Exception Message: Cannot send mails to mail server. (Service not available, closing transmission channel. The server response was: Cannot connect to SMTP server 204.11.56.48 (204.11.56.48:25), connect error 10060).
)
我尝试过:
What I have tried:
EXECUTE msdb.dbo.sysmail_add_account_sp
@account_name = 'MailTest',
@description = 'Sent Mail using SQL Server',
@email_address = 'imran@execsql.org',
@display_name = 'SQL Server-Mail Send',
@username='imran@execsql.org',
@password='your_password',
@mailserver_name = 'your_email_server_name'
--delete from sysmail_account
--select * from sysmail_account
EXECUTE msdb.dbo.sysmail_add_profile_sp
@profile_name = 'MailTest',
@description = 'Profile used to send mail'
--select * from sysmail_profile
EXECUTE msdb.dbo.sysmail_add_profileaccount_sp
@profile_name = 'MailTest',
@account_name = 'MailTest',
@sequence_number = 1
--select * from sysmail_profileaccount
EXECUTE msdb.dbo.sysmail_add_principalprofile_sp
@profile_name = 'MailTest',
@principal_name = 'public',
@is_default = 1 ;
exec msdb.dbo.sp_send_dbmail
@profile_name = 'MailTest',
@recipients = 'paulvinayak70@gmail.com',
@subject = 'Mail Test',
@body = 'Mail Sent Successfully',
@body_format = 'text'
but it gives error
when I execute view
select * from sysmail_allitems
at column send_status it gives values as Failed
and description of error is as
The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 4 (2017-09-07T12:17:46). Exception Message: Cannot send mails to mail server. (Service not available, closing transmission channel. The server response was: Cannot connect to SMTP server 204.11.56.48 (204.11.56.48:25), connect error 10060).
)
推荐答案
错误10060是
Error 10060 is
WSAETIMEDOUT
:连接尝试失败,因为连接方没有正确响应一段时间后,或建立的连接失败,因为连接的主机无法响应。
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
因此,请检查您是否使用了正确的SMTP服务器地址(是在204.11.56.48上运行并侦听端口25的SMTP服务器。另请注意,防火墙可能会断开连接。
So check if you have used the correct SMTP server address (is a SMTP server running on 204.11.56.48 and listening on port 25). Note also that the connection might be dropped by a Firewall.
这篇关于使用SQL Server发送邮件时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文