/* * Set the Return-Path header to define the envelope sender address to * which bounced messages are delivered. * If you are using Windows, you need to use the smtp_message_class to set * the return-path address. */ if (defined("PHP_OS") && strcmp(substr(PHP_OS, 0, 3), "WIN")) { $email_message->SetHeader("Return-Path", $error_delivery_address); } $email_message->SetEncodedHeader("Subject", $subject); /* * A message with attached files usually has a text message part * followed by one or more attached file parts. */ $text_message = "Hello " . strtok($to_name, " ") . "\n\nThis message forwarding another message that is encapsulated as attachment.\n\nThank you,\n{$from_name}"; $email_message->AddQuotedPrintableTextPart($email_message->WrapText($text_message)); $forwarding_message = array("FileName" => "message.eml", "Name" => "[Fwd: Testing Manuel Lemos' MIME E-mail composing and sending PHP class: HTML message]"); $email_message->AddMessagePart($forwarding_message); /* * The message is now ready to be assembled and sent. * Notice that most of the functions used before this point may fail due * to programming errors in your script. You may safely ignore any errors * until the message is sent to not bloat your scripts with too much error * checking. */ $error = $email_message->Send(); if (strcmp($error, "")) { echo "Error: {$error}\n"; } else { echo "Message sent to {$to_name}\n"; }