SQL Server enable mailbox service

Source: Internet
Author: User

1, open the database, find the management to find the Database Mail, right-click Select Configuration

2, Direct next

3.

4 fill in the basic configuration information, the mailbox password should not be written wrong. Otherwise will not send out the mail, also won't error!

Click Next directly. Then finish.

At this point, the configuration is basically successful. , and then to test whether the configuration was successful. Can be executed using the following script.

Then there are several ways to receive the mailbox, (1 Normal text Right-click, with Attachments right-click, the query results as an attachment)

exec dbo.sp_send_dbmail @profile_name = ' toemail ',--this is the name you wrote above,
@recipients = ' [email protected] ',--This is the email address you want to receive
@subject = ' This is a test message ',--This is the title
@body = ' content '-this is a simple textual content

----------------------------a gorgeous delimiter----------------------------------------------------------

---this is about the query results as an attachment sent to the specified mailbox

EXEC Dbo.sp_send_dbmail
@profile_name = ' Toemail ',
@recipients = ' [email protected] ',
@subject = ' query result ',
@body = ' Query results in attachment ',
@query = ' SELECT top ' from Test.dbo.Table1 ',
@attach_query_result_as_file = 1,
@query_attachment_filename = ' tablle1.txt '---attachment name customization.
GO

----------------------------a gorgeous delimiter----------------------------------------------------------

Next we look at the results.

Over

SQL Server enable mailbox service

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.