vlibMimeMail

vLIB logo

4.15. attach()

Function Description
  attach (string filename [, string disposition[, string mimetype[, string content_id]]])

This function attaches a file to the message.

Filename is the 'string' with the include path to the file you want to attach.
Disposition can be 1 of 2 values: Mimetype, if specified, will set the mimetype for this particular attachment. If not specified it will search for the mimetype (using the extension of the file) in vlibCommon/mime_types.php.
Content_id, if specified, will set the Content-ID for this particular attachment. If not specified it will generate a Content-ID automatically. Content-IDs are used to reference mime parts from within the message, for example with an HTML image.

This function return the content_id. You can call this function as many times as you like.

Example

   $cid = $mail->attach('./example.doc');
   $cid = $mail->attach('./example.gif', 'inline', 'image/gif', '[email protected]');