使用SQL Mail收发和自动处理邮件2008-03-14SQL SERVER提供了通过EXCHANGE或OUTLOOK收发邮件的扩展存储过程,下面将这几个过程简单的介绍一下。一、启动SQL Mail@user和@password都是可选的也可打开Enterprise Manager中的Support Services,在SQL Mail上单击右键打开右键菜单,然后按Start来启动二、停止SQL Mailxp_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 查询所用的数据库,默认为缺省数据库