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: Update of examples/text-and-html.php
Date: 1 year ago
Size: 1,007 bytes


Class file image Download

        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 ( '' ) ;

$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
                color : #FF0000 ;
                font-size : 24px ;
                font-weight : bold ;

        example <span>Html</span> contents.

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

    echo (
"Mail sent\n" ) ;