SQL Server provides an extended stored procedure for sending and receiving emails through Exchange or Outlook, which will be briefly introduced below.
1. Start SQL Mail XP_Startmail @ user, @password @user and @password are optional. You can also open Support Services in Enterprise Manager, click right click on SQL Mail, open the right-click menu, then press START to start the second, stop SQL MAIL XP_STOPMAIL can also stop three in the menu in the menu in the above method, send mail xp_sendmail {[@recipients =] 'Recipients [; ... n]'} [, [@ message =] 'message'] [, [@Query =] 'query'] [, [@ attachments =] attachments] [, [@ COPY_RECIPIPIENTS =] '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] [, [@ sepant =] 'Separetor'] [@ echo_error =] 'echo_value'] [, [@ set_user =] 'user'] [ , [@ dbuse =] 'database'] where @Recipients is the required parameter description: Parameter description @Recipients recipient, intermediate with commas separate @Message To send information @query determine the execution and attachment of an email effective query, in addition to trigger Insert table and delete table in the device, this query can reference any object @attachments attachment @ Copy_recipients Cc @BLIND_COPY_RECIENTS Delivery @Subject Title @Attach_Results Specifying Query Result As Annex Send @no_Header Does Not Send Query Results The column name @set_user query join username, the default is the database used by guse @dbuse queries, default is default Database 4 @suppress_attach =] 'suppress_attach'