declare @i int
declare @ret int
declare @intRetCode int
exec @intRetCode = sp_OACreate 'Basp21', @i out //Basp21是调用组件的工程命,如果有类名,也要加上
EXEC @intRetCode = sp_OAMethod @i,'sendmail',@ret OUT,'192.168.1.19','xx@xx.net.cn','xx@xxx.net.cn','happy','newyear','' //sendmail是所要调用的函数名
exec sp_OADestroy @i
用COM组件前需要先注册