www.KevinBurkholder.com

Getting Work Done Through People

Getting People Done Through Work

Thursday, March 4, 2010

eac_mailer.class.php PHP Mail Utility

eac_mailer.class.php

Source Code

Documentation (13pg/280k)

Interested in using this software in your project? Contact Kevin at KBurkholder@EarthAsylum.com
Follow me on Twitter for software updates, releases and announcements.

Overview

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.

Usage Summary

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).

Methods

  • To()
  • Cc()
  • Bcc()
  • From()
  • ReplyTo()
  • Organization()
  • Receipt()
  • Priority()
  • Subject()
  • Body()
  • textBody()
  • htmlBody()
  • encryptBody()
  • Attach()
  • AttachAsFile()
  • AttachImage()
  • SendMail()
  • SetGnuPG()
  • SendEncrypted()
  • GetMail()

 Powered by  eac::Framework 

eac::Framework is a lightweight PHP & JavaScript framework for Web 2.0 Applications and E-Commerce systems.

For more information, visit http://www.KevinBurkholder.com/framework

eac::encryption, eac::session, eac::keychain, eac::dataobjects, eac::tracker, eac::sourcing, eac::authentication, eac::filter, eac::formgen, eac::caching, eac::mailer, eac::download, eac::error, eac::streams and more.

www.KevinBurkholder.com
Strengths Based Performance Management
EarthAsylum Consulting
The EarthAsylum Leadership Circle