    MAIL -> boolean attach ( string content [, string type [, string name [, string charset [, string encoding [, string disposition [, string id ]]]]]] )

    Return TRUE if has been successfully attached, FALSE if not.

    Default values are:
    string type: application/octet-stream
    string charset: us-ascii
    string encoding: base64
    string disposition: attachment

    string encoding possible values are: binary, 7bit, 8bit, quoted-printable or base64
    string disposition possible values are: attachment or inline

    Example (verification):

    $m = new MAIL;

    // attach source
    $a = $m->Attach('text message', 'text/plain');

    $f = '/path/image.gif';
    // attach file '$f', disposition 'inline' and give a name 'photo.gif' with ID value (this ID value can be used in embed HTML images)
    $a = $m->Attach(file_get_contents($f), FUNC::mime_type($f), 'photo.gif', null, null, 'inline', MIME::unique());

    echo $a ? 'attached' : 'error';

    Example (deprecated):

    $m = new MAIL;

    $f = '/path/image.gif';

    $m->Attach[] = array(
    'content' => file_get_contents($f), // required
    'type' => FUNC::mime_type($f), // optional
    'name' => 'image.gif', // optional
    'charset' => 'utf-8', // optional
    'encoding' => 'base64', // optional
    'disposition' => 'inline', // optional
    'id' => MIME::unique() // optional
    );

    See Also: MAIL->DelAttach(), FUNC::mime_type()

    [ Comments ]

    Last update: Monday, June 11, 2007