EmailAttachment.LoadFromFile

From Xojo Documentation

Method

EmailAttachment.LoadFromFile(file As FolderItem)

Supported for all project types and targets.

Attaches the passed File.

Notes

Set the MIMEType for the attachment after loading the file.

Example

This example specifies an attachment file by taking the contents of a TextField.

// add image attachments
If fileField.Value <> "" Then
file = New EmailAttachment
file.LoadFromFile(GetFolderItem(fileField.Value))
file.MIMEType = "image/jpeg"
mail.Attachments.Append(file)
End If