Framework:sb Email
From Surebert wiki
Contents |
Overview
Sending email with sb_Email is easy. It allows for simple, email, HTML email ,logging, attachments, zipping of attachmens, and PGP/GPG encryption.
Methods of sb_Email
__constructor
The arguments to the constructor of sb_Email are similar to php mail with the acception that the argument after $message is from as it is most used. Other headers can be passed by assigning them to the instances headers array.
php code
$email = new sb_Email($to, $subject, $message, $from);
send($outbox)
When sending sb_Email creates an instance of Framework:sb_Email_Writer or uses the one you provide
php code
//returns true or false $email->send();
add_attachment($attachment)
The attachment must be an instance of Framework:sb_Email_Attachment. Both $filepath and $mime_type are optional arguments to the sb_Email_Attachment constructor and can be set later.
A most basic example, see Framework:sb_Email_Attachment for more info
php code
$attachment = new sb_Email_Attachment($filepath, $mime_type); $email->add_attachment($attachment);
properties of sb_Email
cc
An array of addresses to copy the email to
php code
$email->cc = Array('some.addr@domain.com');
bcc
An array of addresses to blind copy the email to
php code
$email->bcc = Array('some.addr@domain.com');
This is the HTML body of the email if the client understands HTML emails. The regular message is sent plain text as well.
body_HTML
php code
$email->body_HTML = '<h1 style="color:red;">hello world</h1>';
If you want to include attachments in the HTML you can, e.g. an image that is a link. you can reference inline attachments in the HTML by their cid:{THEIR NAME} THIS DOES NOT WORK IN ENTOURAGE
php code
$email->body_HTML = '<h1>Hello there</h1><img src="cid:MyPicture.jpg" />';