VpeAddMailAttachment

<< Click to Display Table of Contents >>

Navigation:  E-Mail Functions >

VpeAddMailAttachment

Previous pageReturn to chapter overviewNext page

[Windows platform only; not supported by the Community Edition]

Allows you to specify a list of e-mail attachments (files) by code.

void VpeAddMailAttachment(

VpeHandle hDoc,

LPCSTR path,

LPCSTR file_name

)

VpeHandle hDoc

Document Handle

LPCSTR path

The fully qualified path and file name of the attachment file. This path should include the disk drive letter and directory name. The attachment file should be closed before this call is made.

 

When VpeMailDoc() is called, VPE will examine all attachment paths. If the last character of a path is a backslash ("\"), VPE will write the current document as a temporary file to the specified path and add it as attachment to the mail.

If the examined path is NULL or empty (""), VPE will create and attach the temporary document in the temporary directory specified by the environment variable named TMP or TEMP, or - if both are not set - in the current working directory.

Any temporarily created file will be deleted before the VpeMailDoc() function returns.

 

Otherwise - if a fully qualified path and file name was specified - VPE expects that the attachment file has already been created. This gives you the possibility to mail any kind of attachment, not being limited to VPE-Documents.

LPCSTR file_name

The file name seen by the recipient. This name can differ from the filename in path if temporary files are being used. If file_name is NULL or empty (""), the file name from path is used. If the attachment is an OLE object, file_name contains the class name of the object, such as "Microsoft Excel Worksheet."

Remarks:

By default, the current document is automatically set as an attachment located in the tmp-dir (the file will only be created if - and in the moment when - MailDoc() is executed). The file name of the attachment is either the Application Name or - if VpeOpenDocFile() is used - the document file name. To clear that default, call VpeClearMailAttachments() before specifying your own attachments.

 

The property MailAutoAttachDocType controls, whether a VPE Document or a PDF Document is attached to the e-mail.

Examples:

VpeClearMailAttachments(hDoc)

Deletes the default attachment, which is the VPE Document itself.

 

VpeAddMailAttachment(hDoc, "c:\important_file.zip", NULL)

Sets "c:\important_file.zip" as the ONLY attachment. The VPE Document will not be sent, because VpeClearMailAttachments() deleted the default attachment of the VPE Document.

 

VpeAddMailAttachment(hDoc, "c:\important_file.txt", NULL)

Adds "c:\important_file.txt" as second attachment.

 

VpeWriteDoc(hDoc, "c:\tmp\doc.vpe")

VpeAddMailAttachment(hDoc, "c:\tmp\doc.vpe", NULL)

Adds "c:\tmp\doc.vpe" as third attachment.