EXEC @hr = sp_OACreate 'CDO.Message', @iMsg OUT
EXEC @hr = sp_OASetProperty @iMsg, 'Configuration(cdoSendUsingMethod)', 2 -- use remote SMTP server
EXEC @hr = sp_OASetProperty @iMsg, 'Configuration(cdoSMTPServerName)', 'xxx.xxx.xxx.xxx' -- name of your SMTP mail server
EXEC @hr = sp_OASetProperty @iMsg, 'Configuration(cdoSMTPConnectionTimeout)', 60
EXEC @hr = sp_OAMethod @iMsg, 'Configuration.Fields.Update', null
EXEC @hr = sp_OASetProperty @iMsg, 'To', @Recipients
EXEC @hr = sp_OASetProperty @iMsg, 'CC', @Copy_recipients
EXEC @hr = sp_OASetProperty @iMsg, 'From', 'xxx@xxxx.xx'
EXEC @hr = sp_OASetProperty @iMsg, 'Subject', @Subject
EXEC @hr = sp_OASetProperty @iMsg, 'HTMLBody', @Body
EXEC @hr = sp_OAMethod @iMsg, 'Send', NULL |