Skip to Content
CDO & MAPI Programming with Visual Basic:
book

CDO & MAPI Programming with Visual Basic:

by Dave Grundgeiger
October 2000
Intermediate to advanced
384 pages
10h 22m
English
O'Reilly Media, Inc.
Content preview from CDO & MAPI Programming with Visual Basic:

Sending File Attachments

Sending a file as an attachment is easy. To add attachments to an outgoing message:

  1. Set the AttachmentIndex property of the MAPIMessages control appropriately (0 for the first attachment, 1 for the second attachment, etc.).

  2. Set the AttachmentPathName property to the fully qualified path of the file you would like to send. This is the path of the file as it exists on the sending system. This path is not communicated to the receiving mail client.

  3. Set the AttachmentName property to a short name for the file. This is typically the filename and extension of the file, but it can be any string. The receiving mail client uses this string to name the file on the receiving system, so setting it to a reasonable filename and extension, such as "MyResume.doc", is helpful.

  4. Set the AttachmentType property to mapData, which indicates that the attached file is a data file (as opposed to an embedded OLE object, to be discussed shortly).

  5. Set the AttachmentPosition property to indicate at which character position the attachment should appear. Some mail clients display a representation of the file within the body of the message at the character position indicated by AttachmentPosition. (However, some ignore this value and display the attachments separately.)

    Note the following in regard to the AttachmentPosition property:

    • This property is zero-based, meaning that the first character in the message is at position 0, and the last character in the message is at Len(MAPIMessages1.MsgNoteText) ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Excel® 2007 VBA Programmer's Reference

Excel® 2007 VBA Programmer's Reference

John Green, Stephen Bullen, Rob Bovey, Michael Alexander
COM Programming with Microsoft® .NET

COM Programming with Microsoft® .NET

John Paul Mueller, Julian Templeman

Publisher Resources

ISBN: 156592665XSupplemental ContentCatalog PageErrata