skip to content

 Web design 

Database-driven systems

Easy-to-maintain web sites


 



Libmail

Libmail provides support for sending emails from your PHP program. It supports all of the standard fields, plain text or formatted html output and attachments. For testing, it provides the handy ability to dump the output that it would have sent. This especially useful if you are testing in a local environment without access to a mail server.

One small problem is that it checks email addresses for validity but it sometimes incorrectly identifies emails as being invalid. The module used to exit at that point but it now continues.

You can download the module from here.

 

The syntax that you need to use (also shown in the libmail.php module) is as follows:

 

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
	include "libmail.php";	
 
	$m= new Mail; // create the mail
 
	$m->From( "leo@isp.com" );
 
	$m->To( "destination@somewhere.fr" );
 
	$m->Subject( "the subject of the mail" );	
 
 
 
	$message= "Hello world!nthis is a test of the Mail classnplease ignorenThanks.";
 
	$m->Body( $message);	// set the body
            // use $m->Body( $message,"","html") for an html message
 
	$m->Cc( "someone@somewhere.fr");
 
	$m->Bcc( "someoneelse@somewhere.fr");
 
	$m->Priority(4) ;	// set the priority to Low 
 
	$m->Attach( "/home/leo/toto.gif", "image/gif" ) ;	// attach a file of type image/gif
 
	$m->Send();	// send the mail
 
	echo "the mail below has been sent:<br><pre>", $m->Get(), "</pre>";
 
   

Powered by Website Baker,
Design by Innovations Design based on a template by gavjof