Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
london24
Starting Member
2 Posts |
Posted - 2009-06-02 : 04:12:42
|
HiWhen I execute this stored procedure, the message still gets sent from my own server (windows server 2003 standard edition) but I want it sent from an external smtp server that I have permission to use and successfully use via asp.net pages. Can anyone see what I am doing wrong? Thanks for any help.CREATE PROCEDURE spAutoEmailASdeclare @Text varchar(400)declare @i Integer declare @Subject varchar(100)set @Text = 'Hello'set @Subject = 'Hello'SET NOCOUNT ONDECLARE @MailObject INTDECLARE @ReturnCode INT EXEC @ReturnCode = sp_OACreate 'CDO.Message', @MailObject OUT IF @ReturnCode = 0 BEGINEXEC @ReturnCode = sp_OASetProperty @MailObject, 'Configuration.fields("http://schemas.microsoft.com/cdo/configuration/sendusing").Value','2'EXEC @ReturnCode = sp_OASetProperty @MailObject, 'Configuration.fields("http://schemas.microsoft.com/cdo/configuration/smtpserver").Value', 'smtp.blueyonder.co.uk'EXEC @ReturnCode = sp_OASetProperty @MailObject ,'Configuration.fields("http://schemas.microsoft.com/cdo/configuration/sendusername").Value', 'removed' EXEC @ReturnCode = sp_OASetProperty @MailObject,'Configuration.fields("http://schemas.microsoft.com/cdo/configuration/sendpassword").Value', 'removed' EXEC @ReturnCode = sp_OASetProperty @MailObject, 'To', @To EXEC @ReturnCode = sp_OASetProperty @MailObject, 'From', 'removed' EXEC @ReturnCode = sp_OASetProperty @MailObject, 'Subject', @Subject EXEC @ReturnCode = sp_OASetProperty @MailObject, 'TextBody', @Text EXEC @ReturnCode = sp_OAMethod @MailObject, 'Send', NULL ENDEXEC sp_OADestroy @MailObjectGO |
|
|
|
|
|
|