I'm trying to create and send an email of a report that is generated earlier
in a vbscript file, and I have been successful in generating and sending the
email, but when I try to add an attachment, it gives me an error message
saying the CDO.Message object does not support the method "AddAttachment".
Here's the code I'm using to generate an email:

set objEmail = CreateObject ("CDO.Message")
'generate email of log file every time it is executed
'objEmail.From = "sshah@soa.org"
'objEmail.To = "sshah@soa.org"
'objEmail.Subject = "Content publishing report"
'objEmail.Textbody = "This is the log file from the content migration at "
& now
'objEmail.AddAttachment = "c:\sys\migration_logfile.txt"
'objEmail.Configuration.Fields.Item
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
'objEmail.Configuration.Fields.Item
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "remote
server"
'objEmail.Configuration.Fields.Item
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
'objEmail.Configuration.Fields.Update
'objEmail.Send

Re: create and send email with attachments by Anthony

Anthony
Thu Dec 06 08:41:42 PST 2007


"Sheel" <Sheel@discussions.microsoft.com> wrote in message
news:3D2B87FA-FCAD-406B-B149-85D280571B5A@microsoft.com...
> I'm trying to create and send an email of a report that is generated
earlier
> in a vbscript file, and I have been successful in generating and sending
the
> email, but when I try to add an attachment, it gives me an error message
> saying the CDO.Message object does not support the method
"AddAttachment".
> Here's the code I'm using to generate an email:
>
> set objEmail = CreateObject ("CDO.Message")
> 'generate email of log file every time it is executed
> 'objEmail.From = "sshah@soa.org"
> 'objEmail.To = "sshah@soa.org"
> 'objEmail.Subject = "Content publishing report"
> 'objEmail.Textbody = "This is the log file from the content migration at "
> & now
> 'objEmail.AddAttachment = "c:\sys\migration_logfile.txt"

AddAttachment is not a property

use:-

objEmail.AddAttachment "c:\sys\migration_logfile.txt"


> 'objEmail.Configuration.Fields.Item
> ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
> 'objEmail.Configuration.Fields.Item
> ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "remote
> server"
> 'objEmail.Configuration.Fields.Item
> ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
> 'objEmail.Configuration.Fields.Update
> 'objEmail.Send


--
Anthony Jones - MVP ASP/ASP.NET