Permalink
Browse files

fix XoopsX#73 E-Mail notify from address setting

  • Loading branch information...
nao-pon committed Mar 30, 2015
1 parent fc0c25e commit 364fcc51fac0702d00217a2d72071e82aec92fd9
@@ -157,9 +157,9 @@ function XoopsMultiMailer(){
$xoopsMailerConfig =& $config_handler->getConfigsByCat(XOOPS_CONF_MAILER);
$this->From = $xoopsMailerConfig['from'];
if ($this->From == '') {
- $this->From = $xoopsConfig['adminmail'];
+ $this->From = defined('XOOPS_NOTIFY_FROM_EMAIL')? XOOPS_NOTIFY_FROM_EMAIL : $xoopsConfig['adminmail'];
}
- $this->Sender = $xoopsConfig['adminmail'];
+ $this->Sender = defined('XOOPS_NOTIFY_SENDER_EMAIL')? XOOPS_NOTIFY_SENDER_EMAIL : $xoopsConfig['adminmail'];
if ($xoopsMailerConfig["mailmethod"] == "smtpauth") {
$this->Mailer = "smtp";
$this->SMTPAuth = TRUE;
@@ -131,6 +131,8 @@ function notifyUser($template_dir, $template, $subject, $tags)
//global $xoopsConfig;
//$xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
//$xoopsMailer->setFromName($xoopsConfig['sitename']);
+ if (defined('XOOPS_NOTIFY_FROM_EMAIL')) $xoopsMailer->setFromEmail(XOOPS_NOTIFY_FROM_EMAIL);
+ if (defined('XOOPS_NOTIFY_FROM_NAME')) $xoopsMailer->setFromName(XOOPS_NOTIFY_FROM_NAME);
$xoopsMailer->setSubject($subject);
$success = $xoopsMailer->send();
@@ -60,8 +60,8 @@ function setToUsers($user, $xoopsConfig)
function setFromEmail($user, $xoopsConfig)
{
- $this->mMailer->setFromEmail($xoopsConfig['adminmail']);
- $this->mMailer->setFromName($xoopsConfig['sitename']);
+ $this->mMailer->setFromEmail(defined('XOOPS_NOTIFY_FROM_EMAIL')? XOOPS_NOTIFY_FROM_EMAIL : $xoopsConfig['adminmail']);
+ $this->mMailer->setFromName(defined('XOOPS_NOTIFY_FROM_NAME')? XOOPS_NOTIFY_FROM_NAME : $xoopsConfig['sitename']);
}
function setSubject($user, $xoopsConfig)
@@ -83,12 +83,12 @@ function setTemplate()
function setBody($user,$xoopsConfig,$extraVars)
{
$this->mMailer->assign("SITENAME", $xoopsConfig['sitename']);
- $this->mMailer->assign("ADMINMAIL", $xoopsConfig['adminmail']);
+ $this->mMailer->assign("ADMINMAIL", (!defined('XOOPS_NOTIFY_FROM_EMAIL') || XOOPS_NOTIFY_FROM_EMAIL === $xoopsConfig['adminmail'])? $xoopsConfig['adminmail'] : '');
$this->mMailer->assign("SITEURL", XOOPS_URL . "/");
$this->mMailer->assign("IP", $_SERVER['REMOTE_ADDR']);
$queryString = http_build_query(array(
'email' => $user->getShow('email'),
- 'code' => substr($user->get("pass"), 0, 5),
+ 'code' => substr($user->get("pass"), 0, 5),
));
$this->mMailer->assign("NEWPWD_LINK", XOOPS_URL . "/lostpass.php?" . $queryString);
}
@@ -123,7 +123,7 @@ function setSubject($user, $xoopsConfig)
function setBody($user, $xoopsConfig, $extraVars)
{
$this->mMailer->assign("SITENAME", $xoopsConfig['sitename']);
- $this->mMailer->assign("ADMINMAIL", $xoopsConfig['adminmail']);
+ $this->mMailer->assign("ADMINMAIL", (!defined('XOOPS_NOTIFY_FROM_EMAIL') || XOOPS_NOTIFY_FROM_EMAIL === $xoopsConfig['adminmail'])? $xoopsConfig['adminmail'] : '');
$this->mMailer->assign("SITEURL", XOOPS_URL . "/");
$this->mMailer->assign("IP", $_SERVER['REMOTE_ADDR']);
$this->mMailer->assign("NEWPWD", $extraVars['newpass']);
@@ -85,8 +85,8 @@ function setToUsers($user, $userConfig)
function setFromEmail($xoopsConfig)
{
- $this->mMailer->setFromEmail($xoopsConfig['adminmail']);
- $this->mMailer->setFromName($xoopsConfig['sitename']);
+ $this->mMailer->setFromEmail(defined('XOOPS_NOTIFY_FROM_EMAIL')? XOOPS_NOTIFY_FROM_EMAIL : $xoopsConfig['adminmail']);
+ $this->mMailer->setFromName(defined('XOOPS_NOTIFY_FROM_NAME')? XOOPS_NOTIFY_FROM_NAME : $xoopsConfig['sitename']);
}
function setSubject($user, $xoopsConfig)
@@ -97,7 +97,7 @@ function setSubject($user, $xoopsConfig)
function setBody($user,$xoopsConfig)
{
$this->mMailer->assign('SITENAME', $xoopsConfig['sitename']);
- $this->mMailer->assign('ADMINMAIL', $xoopsConfig['adminmail']);
+ $this->mMailer->assign('ADMINMAIL', (!defined('XOOPS_NOTIFY_FROM_EMAIL') || XOOPS_NOTIFY_FROM_EMAIL === $xoopsConfig['adminmail'])? $xoopsConfig['adminmail'] : '');
$this->mMailer->assign('SITEURL', XOOPS_URL . '/');
$this->mMailer->assign('USERACTLINK', XOOPS_URL . '/user.php?op=actv&uid=' . $user->getVar('uid') . '&actkey=' . $user->getShow('actkey'));
}
@@ -132,8 +132,8 @@ function setToUsers($user, $userConfig)
function setFromUser($xoopsConfig)
{
- $this->mMailer->setFromEmail($xoopsConfig['adminmail']);
- $this->mMailer->setFromName($xoopsConfig['sitename']);
+ $this->mMailer->setFromEmail(defined('XOOPS_NOTIFY_FROM_EMAIL')? XOOPS_NOTIFY_FROM_EMAIL : $xoopsConfig['adminmail']);
+ $this->mMailer->setFromName(defined('XOOPS_NOTIFY_FROM_NAME')? XOOPS_NOTIFY_FROM_NAME : $xoopsConfig['sitename']);
}
function setSubject($user, $xoopsConfig)

0 comments on commit 364fcc5

Please sign in to comment.