I have provided many articles on the Internet for sending mails from sqlserver. Most of them are reprinted. Most of them are about the win2000 + outlook2003 environment. It is of little significance today when the operating system and office have been updated.
At work, I encountered the problem of using sqlserver to send emails. The text is as follows:
Objective: To establish an operator to monitor job completion using the SQL Server proxy's email session
Test environment:
Operating System: windows 2003/windows xp
OutLook: OutLook 2003
Tested Email: yyy@xxx.com
Step 1: Create a configuration file
Start> Control Panel> mail> double-click mail> Add> Configuration File Name (mySqlFile)
Add a new email account-> select POP3 (P)->
User information:
Name: yyy
Email Address: yyy@xxx.com
Logon Information:
Username: yyy
Password :****
Receiving email server (POP3) (I): pop3.xxx.com
Sending mail server (SMTP) (O): smtp.xxx.com
Click other settings-> sending server-> select (my sending server (SMTP) requires verification)-> select login to use
Username: yyy
Password :****
Select Remember password
OK
Test account settings-> succeeded-> next-> OK
Open the OutLook software and test whether the mail can be normally received. Everything is OK and configure the next step.
Note: After OutLook is configured, it must be restarted.
(In other settings in the email account, forget to set the sending server and confirm that the email can be sent)
Step 2: configure the mail configuration file for the database server
Start-> Control Panel-> Administrative Tools-> services-> choose SQLSERVERAGENT service-> properties-> logon->
Select this account (enter the username and password of the operating system currently logged on). Do not select a local system account
Step 3: Check whether database verification is successful
Enterprise Manager-> Expand server-> Management-> SQLServer proxy-> mail session-> mail configuration file drop-down box select mySqlFile point "test" pop-up "started successfully with this configuration file (and stop) an email session is successful.
Click "OK" to restart the Sqlserver proxy service.
Step 4: test the email
Enterprise Manager-> Expand server-> Management-> SQLServer proxy-> operator-> Create operator-> properties-> General Tab
Enter a test mailbox in the email name: aaa@bbb.com point "test" To Go To The aaa@bbb.com to receive the mail
Note: Make sure that outlook is started throughout the process.
If you attempt to open outlook After configuring the sqlserver mail configuration file, the "cannot open default email folder" dialog box appears, because sqlserver occupies the mail configuration file, you need to stop the SQLSERVERAGENT service, open outlook, and then start the SQLSERVERAGENT service.