PHP Classes

File: test_attachment_message.php

Recommend this page to a friend!
  Classes of Manuel Lemos   MIME E-mail message sending   test_attachment_message.php   Download  
File: test_attachment_message.php
Role: Example script
Content type: text/plain
Description: Example script of how to send e-mail messages with attachment files.
Class: MIME E-mail message sending
PHP mailer to compose and send MIME messages
Author: By
Last change: Updated the URLs of the example images.
Date: 11 years ago
Size: 2,984 bytes


Class file image Download
 * test_attachment_message.php
 * @(#) $Header: /opt2/ena/metal/mimemessage/test_attachment_message.php,v 1.4 2012/09/15 09:15:48 mlemos Exp $


 * Trying to guess your e-mail address.
 * It is better that you change this line to your address explicitly.
 * $from_address="";
 * $from_name="My Name";


 * Change these lines or else you will be mailing the class author.
$to_name="Manuel Lemos";

$subject="Testing Manuel Lemos' MIME E-mail composing and sending PHP class for sending messages with attached files";
$email_message=new email_message_class;

 * 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.


 * 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 is just to let you know that the MIME E-mail message composing and sending PHP class is working as expected.\n\nYou may find attached to this messages a text file and and image file.\n\nThank you,\n$from_name";

"Data"=>"This is just a plain text attachment file named attachment.txt .",


 * 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: $error\n";
"Message sent to $to_name\n";