From: Phil_Edney on 13 Feb 2005 21:21 I have a stored proc thats basically a copy of the script from MS to create sp_send_cdosysmail. This work fine using our mailrelay, but there seems to be no clear way to add an attachment. I've tried a simple: EXEC @hr = sp_OAMethod @iMsg, 'AttachFile', NULL, @Attachment but that just causes an unknown name error. I've also tried creating an attachment object but I can't seems to assciate it with the original cdo.message: EXEC @hr = sp_OASetProperty @iMsg, 'MailFormat', @Body EXEC @hr = sp_OACreate 'CDO.Attachment', @iATT OUT EXEC @hr = sp_OASetProperty @iATT, 'Position', 0 EXEC @hr = sp_OASetProperty @iATT, 'Type', @CdoFileData EXEC @hr = sp_OASetProperty @iATT, 'Name', @Attachment EXEC @hr = sp_OAMethod @iMsg, 'CDO.Message.Attachment.Update', null,@iATT I've tried variations on creation of the original object and methods, but I basically just guessing! I've read somewhere that the file has to be accessable as a http path. This is purely a SQL 2000 server, no extras like IIS or any form of exchange client. Has anyone sent attachments using SQL server and CDO? Can you please offer some assisance. Thanks in advance.
From: Phil_Edney on 13 Feb 2005 22:15 Typically, I've found out what I need to know about 30mins after this post. Why doesn't it happen 30 minutes after you first start looking! Ha
From: Tianya on 22 Feb 2005 08:51 Hi, Phil Would you mind sharing your idea about 'CDO sending mail with attachment'? 1. What is the syntax of CDO with attachment? 2. How to use the result of query as attachment? Thanks a lot! Tianya "Phil_Edney" wrote: > I have a stored proc thats basically a copy of the script from MS to create > sp_send_cdosysmail. > This work fine using our mailrelay, but there seems to be no clear way to > add an attachment. > > I've tried a simple: > EXEC @hr = sp_OAMethod @iMsg, 'AttachFile', NULL, @Attachment > but that just causes an unknown name error. > > I've also tried creating an attachment object but I can't seems to assciate > it with the original cdo.message: > EXEC @hr = sp_OASetProperty @iMsg, 'MailFormat', @Body > EXEC @hr = sp_OACreate 'CDO.Attachment', @iATT OUT > EXEC @hr = sp_OASetProperty @iATT, 'Position', 0 > EXEC @hr = sp_OASetProperty @iATT, 'Type', @CdoFileData > EXEC @hr = sp_OASetProperty @iATT, 'Name', @Attachment > > EXEC @hr = sp_OAMethod @iMsg, 'CDO.Message.Attachment.Update', null,@iATT > > I've tried variations on creation of the original object and methods, but I > basically just guessing! > > I've read somewhere that the file has to be accessable as a http path. This > is purely a SQL 2000 server, no extras like IIS or any form of exchange > client. > > Has anyone sent attachments using SQL server and CDO? Can you please offer > some assisance. > > Thanks in advance.
From: Bill_Jefferys on 3 Mar 2005 16:25 I found a solution at the following web site. http://www.sqlteam.com/Forums/topic.asp?TOPIC_ID=20649 "Tianya" wrote: > Hi, Phil > > Would you mind sharing your idea about 'CDO sending mail with attachment'? > > 1. What is the syntax of CDO with attachment? > 2. How to use the result of query as attachment? > > Thanks a lot! > > Tianya > > > "Phil_Edney" wrote: > > > I have a stored proc thats basically a copy of the script from MS to create > > sp_send_cdosysmail. > > This work fine using our mailrelay, but there seems to be no clear way to > > add an attachment. > > > > I've tried a simple: > > EXEC @hr = sp_OAMethod @iMsg, 'AttachFile', NULL, @Attachment > > but that just causes an unknown name error. > > > > I've also tried creating an attachment object but I can't seems to assciate > > it with the original cdo.message: > > EXEC @hr = sp_OASetProperty @iMsg, 'MailFormat', @Body > > EXEC @hr = sp_OACreate 'CDO.Attachment', @iATT OUT > > EXEC @hr = sp_OASetProperty @iATT, 'Position', 0 > > EXEC @hr = sp_OASetProperty @iATT, 'Type', @CdoFileData > > EXEC @hr = sp_OASetProperty @iATT, 'Name', @Attachment > > > > EXEC @hr = sp_OAMethod @iMsg, 'CDO.Message.Attachment.Update', null,@iATT > > > > I've tried variations on creation of the original object and methods, but I > > basically just guessing! > > > > I've read somewhere that the file has to be accessable as a http path. This > > is purely a SQL 2000 server, no extras like IIS or any form of exchange > > client. > > > > Has anyone sent attachments using SQL server and CDO? Can you please offer > > some assisance. > > > > Thanks in advance.
|
Pages: 1 Prev: Errors with linked server Next: Table Spool/Lazy Spool is a symptom of what? |