PHP Classes

File: test_simple_html_mail_message.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in Bookmark in
  Classes of Manuel Lemos  >  MIME E-mail message sending  >  test_simple_html_mail_message.php  >  Download  
File: test_simple_html_mail_message.php
Role: Example script
Content type: text/plain
Description: Example script to demonstrate how to send a simple HTML with the strongly recommended alternative text part
Class: MIME E-mail message sending
PHP mailer to compose and send MIME messages
Author: By
Last change: Initial revision.
Date: 4 years ago
Size: 3,680 bytes


Class file image Download
 * test_simple_html_mail_message.php
 * @(#) $Header: /opt2/ena/metal/mimemessage/test_simple_html_mail_message.php,v 1.1 2005/02/10 03:45:02 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: HTML message";
$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.


<style type=\"text/css\"><!--
body { color: black ; font-family: arial, helvetica, sans-serif ; background-color: #A3C5CC }
A:link, A:visited, A:active { text-decoration: underline }
<table width=\"100%\">
<P>Hello "
.strtok($to_name," ").",<br><br>
This message is just to let you know that the <a href=\"\">MIME E-mail message composing and sending PHP class</a> is working as expected.<br><br>
Thank you,<br>

 * It is strongly recommended that when you send HTML messages,
 * also provide an alternative text version of HTML page,
 * even if it is just to say that the message is in HTML,
 * because more and more people tend to delete HTML only
 * messages assuming that HTML messages are spam.
$text_message="This is an HTML message. Please use an HTML capable mail program to read this message.";

 * Multiple alternative parts are gathered in multipart/alternative parts.
 * It is important that the fanciest part, in this case the HTML part,
 * is specified as the last part because that is the way that HTML capable
 * mail programs will show that part and not the text version part.

 * 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";