Forum und email

imap_mail_compose

(PHP 4, PHP 5)

imap_mail_compose — Erzeugt eine MIME-Nachricht aus Kopf- und Nachrichtenelementen

Beschreibung

string imap_mail_compose ( array $envelope , array $body )

Erzeugt eine MIME-konforme Nachricht aus den in envelope gegebenen Kopfelementen und den Nachrichtenteilen aus body .

Parameter Liste

envelope

Ein assoziatives Array von Kopfzeilenfeldern und Inhalten

body

Die Teile des Mailkörpers als indiziertes Array.

Jeder Teil des Mailkörpers ist ein assoziatives Array mit folgenden möglichen Elementen: "type", "encoding", "subtype", "description" und "contents.data"

Rückgabewerte

Liefert eine MIME-konforme Nachricht

Beispiele

Example#1 imap_mail_compose() Beispiel

<?php

$envelope
["from"]= "[email protected]";
$envelope["to"]  = "[email protected]";
$envelope["cc"]  = "[email protected]";

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

$filename "/tmp/imap.c.gz";
$fp fopen($filename"r");
$contents fread($fpfilesize($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));

?>