AddAttachment

Description

Adds the attachment collection used to store data attached to this email message.

Applies to

MimeMessage object

Syntax

mimemessage.AddAttachment(string attachment)

Argument

Description

mimemessage

A MimeMessage object identifying the email message in which you want to get the attachment collection.

attachment

A string that attaches the file to the email message as the body text.


Return value

Integer.

Returns the index number if it succeeds and -1 if the file does not exist. If any argument's value is null, the method returns null.

Examples

The following example adds c:\image\test01.png and test02.docx as the attachment collection when sending an email.

lnv_SmtpClient.Message.AddAttachment("c:\image\test01.png")
lnv_SmtpClient.Message.AddAttachment("test02.docx")

See also

AddBcc

AddCc

AddLinkedResource

AddRecipient

GetSender

Reset

SetSender