Introduction to the extended stored procedure for sending, receiving, and automatically processing emails using SQL Mail

Source: Internet
Author: User
Introduction to the extended stored procedure for sending, receiving, and automatically processing emails using SQL Mail
SQL SERVER provides an extended storage process for sending and receiving emails through EXCHANGE or OUTLOOK. The following describes these processes.

1. Start SQL Mail
Xp_startmail @ user, @ password
Both @ user and @ password are optional.
You can also open Support Services in Enterprise Manager, right-click SQL Mail, right-click the menu, and then press Start to Start
II. Stop SQL Mail
Xp_stopmail
You can also use Stop in the menu in the above method to Stop
3. Send emails
Xp_sendmail {[@ recipients =] 'Recipients [;... n] '}
[, [@ Message =] 'message>
[, [@ Query =] 'query>
[, [@ Attachments =] attachments]
[, [@ Copy_recipients =] 'copy _ recipients [;... n]'
[, [@ Blind_copy_recipients =] 'blind _ copy_recipients [;... n]'
[, [@ Subject =] 'subject>
[, [@ Type =] 'type>
[, [@ Attach_results =] 'Attach _ value>
[, [@ No_output =] 'output _ value>
[, [@ No_header =] 'header _ value>
[, [@ Width =] width]
[, [@ Separator =] 'separator>
[, [@ Echo_error =] 'echo _ value>
[, [@ Set_user =] 'user>
[, [@ Dbuse =] 'database>
@ Recipients is required.
Parameter description:
Parameter description
@ Recipients separated by commas
@ Message: the message to be sent.
@ Query: determines whether to execute a valid query that is attached to the email. In addition to the Insert table and delete table in the trigger, this query can reference any object.
@ Attachments attachment
@ Copy_recipients CC
@ Blind_copy_recipients BCC
@ Subject title
@ Attach_results: specify the query result to be sent as an attachment.
@ No_header: name of the column that does not send the query result
@ Set_user: query the connected user name. The default value is Guset.
@ Dbuse: the database used for query. The default value is the default database.
4. Read emails in the inbox
Xp_readmail [[@ msg_id =] 'message _ number> [, [@ type =] 'type' [OUTPUT]
[, [@ Peek =] 'peek>
[, [@ Suppress_attach =] 'reress _ attach>
[, [@ Originator =] 'sender' OUTPUT]
[, [@ Subject =] 'subobject' OUTPUT]
[, [@ Message =] 'message' OUTPUT]
[, [@ Recipients =] 'Recipients [;... n] 'output]
[, [@ Cc_list =] 'copy _ recipients [;... n] 'output]

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.