try to fix mail sender
This commit is contained in:
parent
abaee980b5
commit
fd7ce5b38a
1 changed files with 17 additions and 21 deletions
|
@ -18,8 +18,6 @@ class activityReport
|
||||||
public $core;
|
public $core;
|
||||||
public $con;
|
public $con;
|
||||||
|
|
||||||
public $mailer = 'noreply.dotclear.activityreport@jcdenis.com';
|
|
||||||
|
|
||||||
private $ns = 'activityReport';
|
private $ns = 'activityReport';
|
||||||
private $_global = 0;
|
private $_global = 0;
|
||||||
private $blog = null;
|
private $blog = null;
|
||||||
|
@ -670,9 +668,9 @@ class activityReport
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function sendReport($recipients, $msg, $mailformat =' ')
|
private function sendReport($recipients, $message, $mailformat =' ')
|
||||||
{
|
{
|
||||||
if (!is_array($recipients) || empty($msg) || !text::isEmail($this->mailer)) {
|
if (!is_array($recipients) || empty($message)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$mailformat = $mailformat == 'html' ? 'html' : 'plain';
|
$mailformat = $mailformat == 'html' ? 'html' : 'plain';
|
||||||
|
@ -694,32 +692,30 @@ class activityReport
|
||||||
|
|
||||||
# Sending mails
|
# Sending mails
|
||||||
try {
|
try {
|
||||||
$headers = [
|
$subject = mb_encode_mimeheader(
|
||||||
'From: ' . mail::B64Header(__('Activity report module')) . ' <' . $this->mailer . '>',
|
($this->_global ? '[' . $this->core->blog->name . '] ' : '') . __('Blog activity report'),
|
||||||
'Reply-To: <' . $this->mailer . '>',
|
'UTF-8', 'B'
|
||||||
'Content-Type: text/' . $mailformat . '; charset=UTF-8;',
|
);
|
||||||
'MIME-Version: 1.0',
|
|
||||||
'X-Originating-IP: ' . http::realIP(),
|
|
||||||
'X-Mailer: Dotclear',
|
|
||||||
'X-Blog-Id: ' . mail::B64Header($this->core->blog->id),
|
|
||||||
'X-Blog-Name: ' . mail::B64Header($this->core->blog->name),
|
|
||||||
'X-Blog-Url: ' . mail::B64Header($this->core->blog->url)
|
|
||||||
];
|
|
||||||
|
|
||||||
$subject = $this->_global ?
|
$headers = [];
|
||||||
mail::B64Header(__('Blog activity report')) :
|
$headers[] = 'From: ' . (defined('DC_ADMIN_MAILFROM') && DC_ADMIN_MAILFROM ? DC_ADMIN_MAILFROM : 'dotclear@local');
|
||||||
mail::B64Header('[' . $this->core->blog->name . '] ' . __('Blog activity report'));
|
$headers[] = 'Content-Type: text/' . $mailformat .'; charset=UTF-8;';
|
||||||
|
//$headers[] = 'MIME-Version: 1.0';
|
||||||
|
//$headers[] = 'X-Originating-IP: ' . mb_encode_mimeheader(http::realIP(), 'UTF-8', 'B');
|
||||||
|
//$headers[] = 'X-Mailer: Dotclear';
|
||||||
|
//$headers[] = 'X-Blog-Id: ' . mb_encode_mimeheader($this->core->blog->id), 'UTF-8', 'B');
|
||||||
|
//$headers[] = 'X-Blog-Name: ' . mb_encode_mimeheader($this->core->blog->name), 'UTF-8', 'B');
|
||||||
|
//$headers[] = 'X-Blog-Url: ' . mb_encode_mimeheader($this->core->blog->url), 'UTF-8', 'B');
|
||||||
|
|
||||||
$done = true;
|
$done = true;
|
||||||
foreach ($recipients as $email) {
|
foreach ($recipients as $email) {
|
||||||
if (true !== mail::sendMail($email, $subject, $msg, $headers)) {
|
if (true !== mail::sendMail($email, $subject, $message, $headers)) {
|
||||||
$done = false;
|
$done = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {var_dump($e);
|
||||||
$done = false;
|
$done = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $done;
|
return $done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue