AddAttachment Method
Previous  Top  Next


AddAttachment
method adds attachment to e-mail message.

Syntax

[Visual Basic]


Sub
 AddAttachment(objMailAttachment As AddEmailLib.MailAttachment)

Example:

Dim
 objMailAttachment As New AddEmailLib.MailAttachment
objMailAttachment.File = "c:\files\document.pdf"
objMailMessage.AddAttachment objMailAttachment

[VBScript]


Sub
 AddAttachment(objMailAttachment)

Example:

Dim
 objMailAttachment
Set 
objMailAttachment = CreateObject("AddEmail.MailAttachment")
objMailAttachment.File = "c:\files\document.pdf"
objMailMessage.AddAttachment objMailAttachment

[C#]


void
 AddAttachment(AddEmailLib.MailAttachmentClass objMailAttachment);

Example:

AddEmailLib.MailAttachmentClass objMailAttachment = new
 AddEmailLib.MailAttachmentClass();
objMailAttachment.File = "c:\\files\\document.pdf";
objMailMessage.AddAttachment(objMailAttachment);

[C++]


HRESULT AddAttachment(IMailAddress* objMailAttachment);

Example:

AddEmailLib::IMailAttachmentPtr spMailAttachment;
spMailAttachment.CreateInstance(__uuidof
(AddEmailLib::MailAttachment));
spMailAttachment->PutFile("c:\\files\\document.pdf");
spMailMessage->AddAttachment(spMailAttachment);


Parameters

objMailAttachment [in]
Prepared MailAttachment object containing attachment.

Return value

None.

Remarks

Use AddAttachment method to add prepared MailAttachment object to the e-mail message. Application can call AddAttachment method more than once to add more than one attachment to the message.