p2p.wrox.com Forums

Need to download code?

View our list of code downloads.

  Return to Index  

proasp_codeclinic thread: Problems with mail attachments

Message #1 by "Hugh McLaughlin" <hugh@k...> on Thu, 1 Nov 2001 21:48:24
Hi Hugh,

You should pass in either one string that is the path and filename, or a
textstream object for an open file

From MSDN:

AttachFile Method (CDONTS NewMail Object) 
The AttachFile method adds an attachment to the message by reading a file. 

objNewMail.AttachFile(Source [, FileName] [, EncodingMethod] ) 

Required. This NewMail object. 


Required. IStream object or String. The full path and file name of the file
to be attached to the message, or a pointer to an IStream object containing
the file data. 


Optional. String. The file name to appear in the attachment's placeholder in
the message. If FileName is not supplied, the file name from the Source
parameter is used. 


Optional. Long. The manner of encoding the attachment. The following values
are possible: 

EncodingMethod setting  Value  Description  
CdoEncodingUUencode  0  The attachment is to be in UUEncode format
CdoEncodingBase64  1  The attachment is to be in base 64 format.  

-----Original Message-----
From: Hugh McLaughlin [mailto:hugh@k...]
Sent: 01 November 2001 21:48
To: Code Clinic
Subject: [proasp_codeclinic] Problems with mail attachments

Hello Everyone and thanks for your help in advance.  I am developing an 
application which uses CDONTS.NEWMAIL to send emails.  My problem is that 
when I try the following code to attach a file:

objCDOMail.AttachFile strFilePath , strFileName

I get the error:

error '80004005' 
Unspecified error

I have used this code in the past, so I am not sure why it is not 
working.  Any help would be greatly appreciated.  Thanks.

  Return to Index