PHP Classes

File: sample.php

Recommend this page to a friend!
  Classes of Filippo Toso  >  libMail  >  sample.php  >  Download  
File: sample.php
Role: Example script
Content type: text/plain
Description: Sample script
Class: libMail
Send e-mail with attachments and anti-spam headers
Author: By
Last change:
Date: 18 years ago
Size: 1,299 bytes
 

Contents

Class file image Download
<?php
   
include (dirname(__FILE__)."/libmail.php");
   
   
$m= new Mail; // create the mail
   
$m->From ("leo@isp.com");
// $m->From ("leo@isp.com", "Leo at ISP");

   
$m->To ("destination@somewhere.fr");
// $m->To (array("someone@somewhere.fr", "somebody@somewhere.fr"));
// $m->To (array("someone@somewhere.fr" => "Someone", "somebody@somewhere.fr" => "Somebody"));

   
$m->Subject ("the subject of the mail");
   
$m->Body ("Hello\nThis is a test of the Mail component"); // set the body

   
$m->Cc ("someone@somewhere.fr");
// $m->Cc (array("someone@somewhere.fr", "somebody@somewhere.fr"));
// $m->Cc (array("someone@somewhere.fr" => "Someone", "somebody@somewhere.fr" => "Somebody"));

   
$m->Bcc ("someoneelse@somewhere.fr");
// $m->Bcc (array("someone@somewhere.fr", "somebody@somewhere.fr"));
// $m->Bcc (array("someone@somewhere.fr" => "Someone", "somebody@somewhere.fr" => "Somebody"));

   
$m->Priority (4) ; // set the priority to Low

   
$m->Attach ("/home/leo/toto.gif", "image/gif", "inline") ; // attach a file of type image/gif to be displayed in the message if possible
   
$m->Attach ("/home/leo/toto.gif", "image/gif", "attachment", "fun.gif"); // attach toto.gif file as fun.gif

   
$m->Send (); // send the mail
   
echo "Mail was sent:<br><pre>", $m->Get (), "</pre>";
   
?>

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