I'm attempting to get SQL Mail configured so I can use xp_sendmail to send out database query results automatically.
We're doing this via 2 accounts, 1 account (call it sql) calls the MSSQL procedures. Another account(sqlmail) handles all the mailing. In the SQL Mail account screen, the outlook profile config'd does test OK, and mail can be sent and rec'd through outlook. When xp_sendmail is called, it returns the following error:
Server: Msg 18025, Level 16, State 1, Line 0
xp_sendmail: failed with mail error 0x80004005
I'm running SQL Server 2000 SP3, and Exchange Server 2000.
Originally posted by ms_sql_dba
try using xp_smtp_sendmail instead, unless you're planning to receive and process mail as well.
I found a link to that procedure...however, i couldnt find any way for it to automatically attach the results of a query it runs. Would you recommend just using a different command line query function and then using that for the mailing? Or can anyone think of a different way to either a.) get xp_sendmail to work or b.) do the same thing (run a query then attach the results in CSV format to an email.
Originally posted by royxiao
Please confirm you start
SQL Server service and SQL Executive server with the account
can access the email.
If start with system account, the SQL mail can NOT use.
The SQL services are started with the SQL account, which has send/receive/use rights to the SQLMail account. While logged in using the SQL login, mail can be sent and rec'd via outlook(the profile set to be used for SQL Mail) using the SQLMail account.