mimetype :
),
......
+ mail_method : (SMTP or SMTPMX)
)
*
var $templateDir = false;
var $locale = false; // eg. 'en' or 'zh_HK'
+
var $html_locale = false; // eg. 'en' or 'zh_HK'
var $images = array(); // generated list of cid images for sending
var $attachments = false;
+ var $mail_method = 'SMTP';
+
function Pman_Core_Mailer($args) {
foreach($args as $k=>$v) {
// a bit trusting..
$htmltemplate->compile('mail/'. $templateFile.'.body.html');
$htmlbody = $htmltemplate->bufferedOutputObject($content);
+ $this->htmlbody = $htmlbody;
+
// for the html body, we may want to convert the attachments to images.
// var_dump($htmlbody);exit;
if ($this->replaceImages) {
return array(
'recipents' => $parts[0],
'headers' => $parts[1],
- 'body' => $parts[2]
+ 'body' => $parts[2],
+ 'mailer' => $this
);
}
function send($email = false)
///$recipents = array($this->email);
$mailOptions = PEAR::getStaticProperty('Mail','options');
//print_R($mailOptions);exit;
- $mail = Mail::factory("SMTP",$mailOptions);
+
+ if ($this->mail_method == 'SMTPMX' && empty($mailOptions['mailname'])) {
+ $pg->jerr("Mail[mailname] is not set - this is required for SMTPMX");
+
+ }
+
+ $mail = Mail::factory($this->mail_method,$mailOptions);
+ if ($this->debug) {
+ $mail->debug = $this->debug;
+ }
+
$email['headers']['Date'] = date('r');
if (PEAR::isError($mail)) {
$pg->addEvent("COREMAILER-FAIL", false, "mail factory failed");
'To: ' . ( is_array($rcpts) ? implode(', ', $rcpts) : $rcpts ) .
'Subject: ' . @$email['headers']['Subject']
);
- }
-
+ } else {
+ $pg->addEvent("COREMAILER-FAIL", false, $ret->toString());
+ }
+
return $ret;
}