I like your approach, but I have three remarks:
1. I would separate building the email from sending the email into two
different classes.
2. I would return the original object back, and use exceptions for
error-conditions, that way you can use chaining. This would result in
php code like this:
$smtpmail->from($smtp_from, $smtp_from_name);
->to($smtp_to, $smtp_to_name);
->cc($smtp_cc, $smtp_cc_name);
->bcc($smtp_bcc, $smtp_bcc_name);
->attachment($smtp_attachment, $smtp_attachment_name);
->send($smtp_subject, $smtp_body);
The DateTime class does something similar. Obviously in cases where
these functions would return false because of an error situation, this
should be replaced with throwing an exception and still return the object.
3. If I'm not mistaken, you used '#BOUNDARY#' as a separator between
mime parts, this seems a little too simple.
These remarks are personal opinions, feel free to ignore me.
Greetings, Casper
--
PECL development discussion Mailing List (http://pecl.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php