如何利用軟件測試開發技術SQL Server發郵件?
如何利用軟件 測試 開發 技術SQL Server發郵件? SQL Server 數據庫 關鍵字:SQL SQL Server提供了通過EXCHANGE或OUTLOOK收發郵件的擴展存儲過程,下面將這幾個過程簡單的介紹一下。 一、啟動SQL Mail xp_startmail @user,@password @user和@password都是可選
如何利用軟件
測試開發技術
SQL Server發郵件?
SQL Server數據庫
關鍵字:SQL 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] [,[@
clearcase/" target="_blank" >cc_list =] 'copy_recipients [;...n]' OUTPUT] [,[@bcc_list =] 'blind_copy_recipients [;...n]' OUTPUT] [,[@date_received =] 'date' OUTPUT] [,[@unread =] 'unread_value' OUTPUT] [,[@attachments =] 'attachments [;...n]' OUTPUT]) [,[@skip_bytes =] bytes_to_skip OUTPUT] [,[@msg_length =] length_in_bytes OUTPUT] [,[@originator_address =] 'sender_address' OUTPUT]]
參數說明:
參數 說明
原文轉自:http://www.anti-gravitydesign.com