Getting Work Done Through People
Getting People Done Through Work
eac_mailer.class.php PHP Mail Utility
Documentation (13pg/280k)
eac_mailer.class is an object-oriented utility for creating and sending email from within a PHP program. It is a wrapper or abstraction layer to the PEAR Mail and Mail_Mime open-source utilities.
(see http://pear.php.net/manual/en/package.mail.php)
It removes the complexities of the PEAR utilities by exposing methods logical to the creation of email while hiding the technical requirements (such as building headers and encoding data parts).
eac_mailer.class.php supports three sending methods, the internal PHP “mail” method, the Unix/Linux “sendmail” program, and use of an SMTP server.
eac_mailer.class.php supports text and/or html body parts as well as the ability to use templates where specific tags within the body are replaced with memory variables. The body can come from a data stream (in memory) or read from a file.
eac_mailer.class.php supports file attachments of various types and allows a data stream to be attached as a file.
With version 2.08, eac_mailer.class.php supports PGP (Pretty Good Privacy) encryption through the use of GnuPG (GNU Privacy Guard) available on many systems.
eac_mailer.class.php should be installed in any folder in the server’s PHP include path.
First, include the class library in your php document:
require_once(‘eac_mailer.class.php');
Next create an instance of the eac_Mailer class:
$mailer = new mailer();
Create the email:
$mailer->To($to);
$mailer->From($from);
$mailer->Subject($subject);
$mailer->Body($body);
Send the email:
$mailer->send();
Or, use the “quicksend” function built in to eac_mailer.class:
require_once(‘eac_mailer.class.php');
quicksend($to, $from, $subject, $body);
For GnuPG (PGP) Encryption:
$mailer->SetGnuPG(key, pass-phrase, path-to-gnupg, home-of-gnupg);
...
$mailer->SendEncrypted();
key / pass-phrase represent the Key ID and pass phrase to use to sign the mail.
path-to-gnupg is the path to the gnupg executable ("/usr/bin/gpg" by default).
home-of-gnupg is the path to the gnupg home directory ("~/.gnupg" by default).