[cvs] [Wiki] changed: MIMEHowTo
Jan Schneider
jan at horde.org
Tue Mar 30 12:18:57 PST 2004
jan Tue, 30 Mar 2004 12:18:57 -0800
Modified page: http://wiki.horde.org/display.php?page=MIMEHowTo
New Revision: 1.2
@@ -2,27 +2,37 @@
> as a MIME part to an email message. We then need to add a couple of
> additional headers to this message and finally read it back as a string.
For Message Body:
+<code>
$message = &new MIME_Message();
$part = $new MIME_Part('text/calendar', $text_calendar_data);
$message->addPart($part);
+</code>
For Headers:
+<code>
$headers = &new MIME_Headers();
$headers->addHeaders('Header 1', $Header_1_Value);
$headers->addHeaders('Header 2', $Header_2_Value);
$headers->addMIMEHeaders($message);
+</code>
To return the message as a string:
+<code>
$string = $headers->toString() . "\n\n" . $part->toString();
+</code>
> 2. We have an existing text string which contains a valid MIME email message.
> We need to parse this string in order to read back the body of a specific
> MIME part with a certain content type.
+<code>
$message = &MIME_Structure::parseTextMIMEMessage($message_text);
$message->getPart($mime_id);
+</code>
-OR-
+<code>
$map = $message->contentTypeMap();
+</code>
Map is an array with KEY = MIME ID and VALUE = Content type of that ID
More information about the cvs
mailing list