AttachFile

Attaches the file to email message

AttachFile vFile[,vDisplayName][,vContentType]

Parameters

vFile
The name of file being attached (or variable containing the safearray with binary data).
vDisplayName
Optional. The name of the file in the email message. By default, the name will be the same as the attached file name.
vContentType
Optional. The string specifying content type of the file.

Notes

You can use this method only with unspecified ("") and multipart ("multipart/mixed") email types.
The safearray with binary data can be specified instead of file name. In this case the data will be extracted from safearray. In this case the FileStart,FileSize propperties defines where the data are located in the safearray. The data from recordset BLOB field can easy be represented as safearray. Using this feature you can attach that data to email message without temporary file.

Example

mail.From = "myemail@email.address.com"
mail.To = "john@that.address.com"
mail.Subject = "The weekly report"
mail.AttachFile "c:\images\image.jpg","report.jpg","image/jpeg"
mail.Send