$c->group_id = $this->to_group_id;
if (!$c->count()) {
+ //cannot go to second check
if (!empty($request['_ignore_group_count'])) {
if (!$request['_ignore_group_count']) {
$roo->jerr('no_member',array('errcode'=> 100));
if (!$replace_links) {
continue;
}
+ if (empty($cfg)) {
+ continue;
+ }
+ // not available if server_baseurl not set...
$link = DB_DataObject::factory('crm_mailing_list_link');
$link->setFrom(array(
'url' => $href
// fill in BCC
- if (!empty($this->bcc_group_id) && empty($contents['rcpts_group'])) {
- $admin = DB_DAtaObject::Factory('core_group')->lookupMembersByGroupId($this->bcc_group_id,'email');
+ if (!empty($this->bcc_group_id) && $this->bcc_group_id > 0 && empty($contents['rcpts_group'])) {
+ $admin_grp = DB_DAtaObject::Factory('core_group')->load($this->bcc_group_id);
+ $admin = $admin_grp->members('email');
- if (empty($admin)) {
+ if (empty($admin) && $admin_grp->name != 'Empty Group') { // allow 'empty group mname'
return $p->raiseError("template [{$contents['template']}] - bcc group is empty");
}
}
if (!empty($contents['subject_replace'])) {
- foreach ($contents['mapping'] as $pattern => $replace) {
- $contents['subject'] = preg_replace($pattern,$replace,$contents['subject']);
+ if (isset($contents['mapping'])) {
+ foreach ($contents['mapping'] as $pattern => $replace) {
+ $contents['subject'] = preg_replace($pattern,$replace,$contents['subject']);
+ }
+ }
+ foreach ($contents as $k => $v) {
+ if (is_string($v)) {
+ $contents['subject'] = str_replace('{'. $k . '}', $v, $contents['subject']);
+ }
}
}
mkdir(dirname($cachePath), 0700, true);
}
- file_put_contents($cachePath, $this->bodytext);
+ if (empty($this->use_file)) {
+ file_put_contents($cachePath, $this->bodytext);
+ return;
+ }
+ // use-file -- uses the original template...
+ $mailtext = file_get_contents($this->use_file);
+
+ require_once 'Mail/mimeDecode.php';
+ require_once 'Mail/RFC822.php';
+ $decoder = new Mail_mimeDecode($mailtext);
+ $parts = $decoder->getSendArray();
+ file_put_contents($cachePath,$parts[2]);
+
}
function cachedImages()
return false;
}
+ if (!empty($this->use_file)) {
+ $ctime = filemtime($cachePath);
+ $mtime = filemtime($this->use_file);
+ if($ctime >= $mtime){
+ return true;
+ }
+ return false;
+
+ }
+
+
$ctime = filemtime($cachePath);
$mtime = array();
if (!empty($master)) {
$opts['master'] = $mail_template_dir . $master .'.html';
}
- print_r($opts);
+ //print_r($opts);
require_once 'Pman/Core/Import/Core_email.php';
$x = new Pman_Core_Import_Core_email();
$x->get('', $opts);