PHP Classes

File: examples/text-and-html.php

Recommend this page to a friend!
  Classes of Christian Vigh  >  PHP Mail Sending  >  examples/text-and-html.php  >  Download  
File: examples/text-and-html.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Mail Sending
Send HTML email messages with attachments
Author: By
Last change: Initial release
Date: 7 months ago
Size: 1,007 bytes
 

Contents

Class file image Download
<?php
   
/****************************************************************************************************

        The following example sends an email with text and html parts.
        The html part will be displayed to your recipient if his messenging client supports viewing
        html contents.

     ****************************************************************************************************/

   
require ( 'examples.inc.php' ) ;

   
$subject = "Example mail : text + html" ;
   
$text = "example text contents" ;

   
// Html contents - this will display the string "example Html contents", with a big "Html" word displayed in red
    // Note that you can use inline style definitions
   
$html = <<<END
<style>
            span
               {
                color : #FF0000 ;
                font-size : 24px ;
                font-weight : bold ;
                }
        </style>

        example <span>Html</span> contents.
END;

   
$mail = new Mail ( $sender, $recipient, $subject, $text, $html ) ;
   
$mail -> Send ( ) ;

    echo (
"Mail sent\n" ) ;

For more information send a message to info at phpclasses dot org.