$element->setAttribute('height', '1');
$html = $doc->getElementsByTagName('html');
- $html->item(0)->appendChild($element);
+ if ($html->length) {
+ $html->item(0)->appendChild($element);
+ }
$this->plaintext = str_replace("{unsubscribe_link}", $unsubscribe, $this->plaintext);
}
}
if(empty($this->id)){
- return PEAR::raiseError("template [{$contents['template']}]has not been set");
+ $p = new PEAR();
+ return $p->raiseError("template [{$contents['template']}]has not been set");
}
if(empty($contents['subject'])){
$contents['subject'] = $this->subject;
}
+ if(!empty($contents['rcpts']) && is_array($contents['rcpts'])){
+ $contents['rcpts'] = implode(',', $contents['rcpts']);
+ }
+
$ui = posix_getpwuid(posix_geteuid());
$cachePath = session_save_path() . '/email-cache-' . $ui['name'] . '/mail/' . $this->tableName() . '-' . $this->id . '.txt';
return $ret;
}
- return $r->send($ret);
+ return $r->send();
}
function cachedMailWithOutImages($force = false, $replace_links = true)
{
- print_r('run');exit;
+
$ui = posix_getpwuid(posix_geteuid());
$cachePath = session_save_path() . '/email-cache-' . $ui['name'] . '/mail/' . $this->tableName() . '-' . $this->id . '.txt';
- if ($this->isGenerated($cachePath)) {
+ if (!$force && $this->isGenerated($cachePath)) {
return;
}
fwrite($fh, implode("\n", array(
"From: {if:t.messageFrom}{t.messageFrom:h}{else:}{t.messageFrom():h}{end:}",
- "To: {if:t.person}{t.person.getEmailFrom():h}{else:}{foreach:rcpts,v}{v:h},{end:}{end:}",
- "{if:t.replyTo}Reply-To: {t.replyTo:h}{end:}",
+ "To: {if:t.person}{t.person.getEmailFrom():h}{else:}{rcpts:h}{end:}",
"Subject: {t.subject} ",
- "X-Message-ID: {t.id} "
+ "X-Message-ID: {t.id} ",
+ "{if:t.replyTo}Reply-To: {t.replyTo:h}{end:}"
))."\n");
mkdir(dirname($cachePath), 0700, true);
}
- file_put_contents($cachePath, 'test');
+ file_put_contents($cachePath, $this->bodytext);
}