使用SQL Mail收發和自動處理郵件中的擴充預存程序簡介

來源:互聯網
上載者:User
使用SQL Mail收發和自動處理郵件中的擴充預存程序簡介
SQL SERVER提供了通過EXCHANGE或OUTLOOK收發郵件的擴充預存程序,下面將這幾個過程簡單的介紹一下。
 
一、啟動SQL Mail
xp_startmail @user,@password
@user和@password都是可選的
也可開啟Enterprise Manager中的Support Services,在SQL Mail上單擊右鍵開啟右鍵菜單,然後按Start來啟動
二、停止SQL Mail
xp_stopmail
也可用上述方法中的菜單裡的Stop來停止
三、發送郵件
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是必需的
參數說明:
參數 說明
@recipients 收件者,中間用逗號分開
@message 要發送的資訊
@query 確定執行並依附郵件的有效查詢,除觸發器中的插入表及刪除表外,此查詢能引用任何對象
@attachments 附件
@copy_recipients 抄送
@blind_copy_recipients 密送
@subject 標題
@attach_results 指定查詢結果做為附件發送
@no_header 不發送查詢結果的列名
@set_user 查詢聯結的使用者名稱,預設為Guset
@dbuse 查詢所用的資料庫,預設為預設資料庫
四、閱讀郵件收件匣中的郵件
xp_readmail [[@msg_id =] 'message_number> [, [@type =] 'type' [OUTPUT]]
[,[@peek =] 'peek>
[,[@suppress_attach =] 'suppress_attach>
[,[@originator =] 'sender' OUTPUT]
[,[@subject =] 'subject' OUTPUT]
[,[@message =] 'message' OUTPUT]
[,[@recipients =] 'recipients [;...n]' OUTPUT]
[,[@cc_list =] 'copy_recipients [;...n]' OUTPUT]

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.