Here's the current stored procedure I have for sending mail...
This sp works - it sends email from one account to another - you'll noticee
theres no visible to, from or subject in the header, thus not appearing in
the email message itself.
Hopefully someone will find a problem.
thanks in advance Howie - and anyone else brave enough to try :-)
Tom
CREATE PROCEDURE [send_email] AS
print 'testing sp com-embedded code'
DECLARE @object int
DECLARE @hr int
declare @tmpresult int
declare @tmpResultString varchar(5000)
EXEC @hr = sp_OACreate 'iMSMail.SendMail', @object OUT
select @hr as 'create object'
IF @hr <> 0
BEGIN
print 'failure!!!'
RETURN
END
EXEC @hr = sp_OASetProperty @object, 'SpoolDir', 'f:\ims\out\'
select @hr as 'set_spool_Dir'
EXEC @hr = sp_OASetProperty @object, 'smtpto','[EMAIL PROTECTED]'
select @hr as 'smtpto'
EXEC @hr = sp_OASetProperty @object,
'smtpfrom','[EMAIL PROTECTED]'
select @hr as 'smtpfrom'
EXEC @hr = sp_OASetProperty @object, 'body','this is aa123aaessage 3333'
select @hr as 'body'
-- These are the lines that dont work, but should
EXEC sp_OAMethod @object, 'SetHeader', 'To', '[EMAIL PROTECTED]'
EXEC sp_OAMethod @object, 'setHeader', 'from', 'thotmail.com'
EXEC sp_OAMethod @object, 'setHeader', 'subject', 'some subject'
-- The lines above were also tried like the line below, the difference is if
it sets a variable or not
-- EXEC @hr = sp_OAMethod @object, 'setHeader', 'From',
'[EMAIL PROTECTED]'
-- select @hr as 'hd_from'
-- EXEC @hr = sp_OAMethod @object, 'setHeader', 'Subject', 'test subject
line'
-- select @hr as 'subject'
EXEC @hr = sp_OAMethod @object, 'SendMail'
select @hr as 'sendmail'
EXEC @hr = sp_OAGetProperty @object, 'Result', @tmpResult OUT
EXEC @hr = sp_OAGetProperty @object, 'ResultString', @tmpResultString OUT
-- RETURN
--print 'sending mail is complete'
select @tmpResult as tmpResult
select @tmpResultString as tmpResultString
========================================================================
This list server is Powered by iMS
'The Swiss Army Knife of Mail Servers'
--------------------------------------
To leave this list please complete the form at
http://www.coolfusion.com/iMSSupport.cfm
Need an iMS Developer license? Sign up for a free license here:
http://www.coolfusion.com/iMSDevelopers.cfm
List archives: http://www.mail-archive.com/infusion-email%40eoscape.com/
========================================================================