imap_mail_compose

(PHP 4, PHP 5)

imap_mail_composeCrée un message MIME

Description

string imap_mail_compose ( array $envelope , array $body )

Crée un message MIME basé sur l'enveloppe envelope et les sections body.

Liste de paramètres

envelope

Un tableau associatif contenant les champs des en-têtes. Les clés valides sont : "remail", "return_path", "date", "from", "reply_to", "in_reply_to", "subject", "to", "cc", "bcc", "message_id" et "custom_headers" (qui contient un tableau associatif d'autres en-têtes).

body

Un tableau indexé du corps

Un corps est un tableau associatif qui peut contenir les clés suivantes : "type", "encoding", "charset", "type.parameters", "subtype", "id", "description", "disposition.type", "disposition", "contents.data", "lines", "bytes" et "md5".

Valeurs de retour

Retourne le message MIME.

Exemples

Exemple #1 Exemple avec imap_mail_compose()

<?php

$envelope["from"]= "joe@example.com";
$envelope["to"]  = "foo@example.com";
$envelope["cc"]  = "bar@example.com";

$part1["type"] = TYPEMULTIPART;
$part1["subtype"] = "mixed";

$filename = "/tmp/imap.c.gz";
$fp = fopen($filename, "r");
$contents = fread($fp, filesize($filename));
fclose($fp);

$part2["type"] = TYPEAPPLICATION;
$part2["encoding"] = ENCBINARY;
$part2["subtype"] = "octet-stream";
$part2["description"] = basename($filename);
$part2["contents.data"] = $contents;

$part3["type"] = TYPETEXT;
$part3["subtype"] = "plain";
$part3["description"] = "description3";
$part3["contents.data"] = "contents.data3\n\n\n\t";

$body[1] = $part1;
$body[2] = $part2;
$body[3] = $part3;

echo nl2br(imap_mail_compose($envelope, $body));

?>

LoadingChargement en cours