Beispiel #1
0
 * |                                                                              |
 * |                  http://www.phpguru.org/static/license.html                  |
 * o------------------------------------------------------------------------------o
 *
 * © Copyright 2008,2009 Richard Heyes
 */
/**
 * This example shows you how to create an email with another email attached
 */
require_once 'htmlMimeMail5.php';
/**
 * Create the attached email
 */
$attachment = new htmlMimeMail5();
$attachment->setFrom('Bob <*****@*****.**>');
$attachment->setText('This email is attached.');
$attachment->setSubject('This email is attached.');
$body = $attachment->getRFC822(array('*****@*****.**'));
/**
 * Now create the email it will be attached to
 */
$mail = new htmlMimeMail5();
$mail->addAttachment(new StringAttachment($body, 'Attached message', 'message/rfc822', new SevenBitEncoding()));
$mail->addAttachment(new FileAttachment('example.zip'));
$mail->setFrom('Richard <*****@*****.**>');
$mail->setSubject('Test email');
$mail->setText('Sample text');
$result = $mail->send(array('*****@*****.**'));
?>

Message has been sent