Download RGraph: HTML5 graphing software...

« Back

Documentation for the Rmail PHP email class

Introduction

Rmail is a PHP class for sending a wide variety of types of email in PHP. Amongst others, it can send:

Basically, if there's a type of email you want to send, this class can probably do it!

Example

What follows is an example usage. You can also see the example.php file to see what it looks like.

<?php
    require_once('Rmail.php');
    
    $mail = new Rmail();                                       // Create the email object
    $mail->setFrom('Richard <richard@example.com>');     // Set the From: address
    $mail->setCc('Bob <bob@example.com>');               // Set the Cc: address (es)
    $mail->setBcc('Fred <fred@example.com>');            // Set the Bcc: address(es)
    $mail->setSubject('Test email');                           // Set the subject
    $mail->setPriority('high');                                // Set the priority
    $mail->setText('Sample text');                             // Set the text
    $mail->setHTML('<b>Sample HTML</b> Hello world!'); // Set the HTML (optional)
    $mail->setReceipt('test@test.com');                        // Set a receipt
    $mail->addAttachment(new FileAttachment('/path/to/file')); // Add a file to the email
    $result = $mail->send(array('recipient@domain.com'));      // Send the email
?>

In the archive you'll find example2.php, which shows you how you can use the getRFC822() method to retrieve the raw email, and subsequently attach it to another email.

Method reference

Here follows a list of methods available to you to use and what they do.g