\Pluf_Mail

Generate and send multipart emails.

This class is just a small wrapper around the PEAR packages Mail and Mail/mime.

Class to easily generate multipart emails. It supports embedded images within the email. It can be used to send a text with possible attachments.

The encoding of the message is utf-8 by default.

Usage example: $email = new Pluf_Mail('from_email@example.com', 'to_email@example.com', 'Subject of the message'); $img_id = $email->addAttachment('/var/www/html/img/pic.jpg', 'image/jpg'); $email->addTextMessage('Hello world!'); $email->addHtmlMessage('Hello world!'); $email->sendMail();

The configuration parameters are the one for Mail::factory with the 'mail_' prefix not to conflict with the other parameters.

Summary

Methods
Properties
Constants
__construct()
addTextMessage()
setReturnPath()
addHeaders()
addHtmlMessage()
addAttachment()
sendMail()
$headers
$message
$encoding
$to_address
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$headers

$headers : 

Type

$message

$message : 

Type

$encoding

$encoding : 

Type

$to_address

$to_address : 

Type

Methods

__construct()

__construct(  $src,   $dest,   $subject,   $encoding = 'UTF-8',   $crlf = "\n") 

Construct the base email.

Parameters

$src
$dest
$subject
$encoding
$crlf

addTextMessage()

addTextMessage(  $msg) 

Add the base plain text message to the email.

Parameters

$msg

setReturnPath()

setReturnPath(  $email) 

Set the return path for the email.

Parameters

$email

addHeaders()

addHeaders(  $hdrs) 

Add headers to an email.

Parameters

$hdrs

addHtmlMessage()

addHtmlMessage(  $msg) 

Add the alternate HTML message to the email.

Parameters

$msg

addAttachment()

addAttachment(  $file,   $ctype = 'text/plain') : boolean

Add an attachment to the message.

The file to attach must be available on disk and you need to provide the mimetype of the attachment manually.

Parameters

$file
$ctype

Returns

boolean —

True.

sendMail()

sendMail() 

Effectively sends the email.