Explained using SQL Server 2005/2008 database to send e-mail

sp_configure Exec ' Show advanced Options ' , 1
RECONFIGURE the WITH OVERRIDE
Go
Exec sp_configure ' Database XPS mail ' , 1
RECONFIGURE the WITH OVERRIDE
Go

- 2 . Create a mail account information
EXEC msdb..sysmail_add_account_sp
@ACCOUNT_NAME = ' ETLErrorMailLog ' , - mail account name
@EMAIL_ADDRESS = ' ******@126.com ' , - the sender e-mail address
@DISPLAY_NAME = ' system administrator ' , - the sender's name
= NULL @REPLYTO_ADDRESS,
@DESCRIPTION = NULL,
@MAILSERVER_NAME = ' SMTP.126.COM ' , - the mail server address
@MAILSERVER_TYPE = ' the SMTP ' , - mail protocol
@PORT = 25 , - the mail server port
@USERNAME = ' ******@126.com ' , - user name
@PASSWORD = ' ****** ' , - password
@USE_DEFAULT_CREDENTIALS = 0 ,
@ENABLE_SSL = 0 ,
@ACCOUNT_ID = NULL
The GO

- . 3 . Profile database
IF EXISTS ( SELECT name from msdb..sysmail_profile WHERE name = N ' ETLErrorProfileLog ' )
the begin
Exec msdb..sysmail_delete_profile_sp
@ PROFILE_NAME = ' ETLErrorProfileLog '
End
Exec msdb..sysmail_add_profile_sp
@profile_name = ' ETLErrorProfileLog ' , - profile name
@description = ' database Mail profile ' , - profile described
@profile_id = null
Go



- . 4 . User profiles and messages associated
Exec msdb..sysmail_add_profileaccount_sp
@profile_name = ' ETLErrorProfileLog ' , - profile name
@account_name = ' ETLErrorMailLog ' , - Account Name
@sequence_number = . 1 - Account profile in order

- . 5 . test sending text messages
Exec msdb..sp_send_dbmail
@ PROFILE_NAME = ' ETLErrorProfileLog ' ,
@ = recipients ' ******@qq.com ' , - recipient
@ subject =' The Test Test title the this IS ' ,
@ N body = ' Z Chinese Chinese message content the message content '
Go






I set up the machine after a successful, but also on the server is set up again, but in any case the server can not send mail, send e-mail status display described in (SMTP server I'm using smtp.gmail.com):

Because the mail server failure, mail can not be sent to the recipient. (Using the account 1 (2010-05-24T09: 57: 05) Send Mail abnormal message: can not send mail to the mail server (operation timed out)...)

or

Because the mail server failure, mail can not be sent to the recipient. (Using the account 1 (2010-05-24T16: 14: 16) Send Mail abnormal message: Unable to connect to the mail server (because the target machine actively refused Unable to connect 74.125.127.109:587)...)

The last inspection was discovered that McAfee is blocked on the server SMTP port outside the company:

2010-5-24 16:15:16 by port blocking rules stop C: \ Program Files \ Microsoft SQL Server \ MSSQL10.MSSQLSERVER \ MSSQL \ Binn \ DatabaseMail.exe standard anti-virus protection: Do not mass-mailing worm sends e-mail 74.125.127.109 : 587

As a result, the set McAfee to send the message to normal.

Reproduced in: https: //www.cnblogs.com/daretodream/archive/2012/02/08/2342547.html

Guess you like

Origin blog.csdn.net/weixin_34066347/article/details/93324185