mirror of
https://github.com/e107inc/e107.git
synced 2025-01-17 20:58:30 +01:00
Standard mailer and bulk mailer can now be different. eg. Use PHP for standard mails, but use Amazon.com SES service for bulk mailing, mailing lists etc.
This commit is contained in:
parent
a0ee67407a
commit
ca83bbf73e
@ -564,14 +564,17 @@ class mailout_main_ui extends e_admin_ui
|
||||
if(trim($_POST['testaddress']) == '')
|
||||
{
|
||||
$mes->addError(LAN_MAILOUT_19);
|
||||
$subAction = 'error';
|
||||
return null;
|
||||
}
|
||||
else
|
||||
|
||||
if(empty($pref['bulkmailer']))
|
||||
{
|
||||
$pref['bulkmailer'] = $pref['mailer'];
|
||||
}
|
||||
|
||||
$add = ($pref['mailer']) ? " (".strtoupper($pref['mailer']).") " : ' (PHP)';
|
||||
$add = ($pref['bulkmailer']) ? " (".strtoupper($pref['bulkmailer']).") " : ' (PHP)';
|
||||
|
||||
if($pref['mailer'] == 'smtp')
|
||||
if($pref['bulkmailer'] == 'smtp')
|
||||
{
|
||||
$add .= "Port: ".varset($pref['smtp_port'],25);
|
||||
$add .= " - ".str_replace("secure=", "", $pref['smtp_options']);
|
||||
@ -590,9 +593,7 @@ class mailout_main_ui extends e_admin_ui
|
||||
'media' => array(
|
||||
0 => array('path' => '{e_PLUGIN}gallery/images/butterfly.jpg'),
|
||||
1 => array('path' => 'h-v880sXEOQ.youtube'),
|
||||
|
||||
)
|
||||
|
||||
);
|
||||
|
||||
if(E107_DEBUG_LEVEL > 0)
|
||||
@ -600,16 +601,20 @@ class mailout_main_ui extends e_admin_ui
|
||||
$eml['SMTPDebug'] = true;
|
||||
}
|
||||
|
||||
if (!e107::getEmail()->sendEmail($sendto, LAN_MAILOUT_189, $eml))
|
||||
|
||||
$options = array('mailer'=>$pref['bulkmailer']);
|
||||
|
||||
|
||||
if (!e107::getEmail($options)->sendEmail($sendto, LAN_MAILOUT_189, $eml))
|
||||
{
|
||||
$mes->addError(($pref['mailer'] == 'smtp') ? LAN_MAILOUT_67 : LAN_MAILOUT_106);
|
||||
$mes->addError(($pref['bulkmailer'] == 'smtp') ? LAN_MAILOUT_67 : LAN_MAILOUT_106);
|
||||
}
|
||||
else
|
||||
{
|
||||
$mes->addSuccess(LAN_MAILOUT_81. ' ('.$sendto.')');
|
||||
e107::getAdminLog()->log_event('MAIL_01', $sendto, E_LOG_INFORMATIVE,'');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1087,7 +1092,7 @@ class mailout_main_ui extends e_admin_ui
|
||||
<td>";
|
||||
|
||||
|
||||
$text .= mailoutAdminClass::mailerPrefsTable($pref);
|
||||
$text .= mailoutAdminClass::mailerPrefsTable($pref, 'bulkmailer');
|
||||
|
||||
|
||||
/* FIXME - posting SENDMAIL path triggers Mod-Security rules.
|
||||
|
@ -168,6 +168,7 @@
|
||||
<core name="mail_sendstyle">texthtml</core>
|
||||
<core name="mail_workpertick">5</core>
|
||||
<core name="mailer">php</core>
|
||||
<core name="bulkmailer">smtp</core>
|
||||
<core name="main_wordwrap"></core>
|
||||
<core name="maintainance_flag">0</core>
|
||||
<core name="make_clickable">0</core>
|
||||
|
@ -775,11 +775,17 @@ class e107
|
||||
* @param string $regpath additional registry path
|
||||
* @return Object
|
||||
*/
|
||||
public static function getSingleton($class_name, $path = true, $regpath = '')
|
||||
public static function getSingleton($class_name, $path = true, $regpath = '',$vars=null)
|
||||
{
|
||||
|
||||
$id = 'core/e107/singleton/'.$class_name.$regpath;
|
||||
|
||||
if(!empty($vars))
|
||||
{
|
||||
$id .= '/';
|
||||
$id .= is_array($vars) ? crc32(serialize($vars)): crc32($vars);
|
||||
}
|
||||
|
||||
//singleton object found - overload not possible
|
||||
if(self::getRegistry($id))
|
||||
{
|
||||
@ -821,7 +827,7 @@ class e107
|
||||
}
|
||||
if(class_exists($class_name, false))
|
||||
{
|
||||
e107::setRegistry($id, new $class_name());
|
||||
e107::setRegistry($id, new $class_name($vars));
|
||||
}
|
||||
|
||||
return self::getRegistry($id);
|
||||
@ -1225,9 +1231,9 @@ class e107
|
||||
*
|
||||
* @return e107Email
|
||||
*/
|
||||
public static function getEmail()
|
||||
public static function getEmail($overrides=null)
|
||||
{
|
||||
return self::getSingleton('e107Email', true);
|
||||
return self::getSingleton('e107Email', true, null, $overrides);
|
||||
}
|
||||
|
||||
|
||||
|
@ -197,6 +197,8 @@ class e107Email extends PHPMailer
|
||||
$pref = e107::pref('core');
|
||||
$tp = e107::getParser();
|
||||
|
||||
print_a($overrides);
|
||||
|
||||
if(defined('MAIL_DEBUG'))
|
||||
{
|
||||
$this->debug = true;
|
||||
|
@ -216,9 +216,19 @@ class e107MailManager
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($overrides = FALSE)
|
||||
public function __construct($overrides = false)
|
||||
{
|
||||
$this->e107 = e107::getInstance();
|
||||
|
||||
$pref = e107::pref('core');
|
||||
|
||||
$bulkmailer = (!empty($pref['bulkmailer'])) ? $pref['bulkmailer'] : $pref['mailer'];
|
||||
|
||||
if($overrides === false)
|
||||
{
|
||||
$overrides = array('mailer'=>$bulkmailer);
|
||||
}
|
||||
|
||||
$this->mailOverrides = $overrides;
|
||||
|
||||
if(deftrue('e_DEBUG'))
|
||||
@ -247,7 +257,7 @@ class e107MailManager
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function mailToDb(&$data, $addMissing = FALSE)
|
||||
public function mailToDb(&$data, $addMissing = false)
|
||||
{
|
||||
$res = array();
|
||||
$res1 = array();
|
||||
@ -745,10 +755,9 @@ class e107MailManager
|
||||
|
||||
}
|
||||
|
||||
// else
|
||||
{
|
||||
|
||||
$result = $this->mailer->sendEmail($email['mail_recipient_email'], $email['mail_recipient_name'], $mailToSend, TRUE);
|
||||
}
|
||||
|
||||
|
||||
if($this->debugMode)
|
||||
{
|
||||
@ -1310,7 +1319,7 @@ class e107MailManager
|
||||
|
||||
if (!$this->db->update('mail_content',$query))
|
||||
{
|
||||
$this->e107->admin_log->e_log_event(10,-1,'MAIL','Activate/hold mail','mail_content: '.$query.'[!br!]Fail: '.$this->db->mySQLlastErrText,FALSE,LOG_TO_ROLLING);
|
||||
e107::getLog()->e_log_event(10,-1,'MAIL','Activate/hold mail','mail_content: '.$query.'[!br!]Fail: '.$this->db->mySQLlastErrText,FALSE,LOG_TO_ROLLING);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -1319,7 +1328,7 @@ class e107MailManager
|
||||
// echo "Update individual emails: {$query}<br />";
|
||||
if (FALSE === $this->db->update('mail_recipients',$query))
|
||||
{
|
||||
$this->e107->admin_log->e_log_event(10,-1,'MAIL','Activate/hold mail','mail_recipient: '.$query.'[!br!]Fail: '.$this->db->mySQLlastErrText,FALSE,LOG_TO_ROLLING);
|
||||
e107::getLog()->e_log_event(10,-1,'MAIL','Activate/hold mail','mail_recipient: '.$query.'[!br!]Fail: '.$this->db->mySQLlastErrText,FALSE,LOG_TO_ROLLING);
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
|
@ -2102,7 +2102,7 @@ class mailoutAdminClass extends e107MailManager
|
||||
|
||||
|
||||
|
||||
public static function mailerPrefsTable($pref)
|
||||
public static function mailerPrefsTable($pref, $id='mailer')
|
||||
{
|
||||
|
||||
$frm = e107::getForm();
|
||||
@ -2110,9 +2110,9 @@ class mailoutAdminClass extends e107MailManager
|
||||
$mailers = array('php'=>'php','smtp'=>'smtp','sendmail'=>'sendmail');
|
||||
|
||||
$smtp_opts = explode(',',varset($pref['smtp_options'],''));
|
||||
$smtpdisp = ($pref['mailer'] != 'smtp') ? "style='display:none;'" : '';
|
||||
$smtpdisp = ($pref[$id] != 'smtp') ? "style='display:none;'" : '';
|
||||
|
||||
$text = $frm->select('mailer', $mailers, $pref['mailer'])."
|
||||
$text = $frm->select($id, $mailers, $pref[$id])."
|
||||
<span class='field-help'>".LAN_MAILOUT_116."</span>";
|
||||
|
||||
$text .= "<div id='smtp' {$smtpdisp}>
|
||||
@ -2193,7 +2193,7 @@ class mailoutAdminClass extends e107MailManager
|
||||
|
||||
e107::js('footer-inline', "
|
||||
|
||||
$('#mailer').on('change', function() {
|
||||
$('#".$id."').on('change', function() {
|
||||
|
||||
var type = $(this).val();
|
||||
|
||||
|
@ -125,7 +125,7 @@ define("LAN_MAILOUT_111", "Email Title (not sent)");
|
||||
define("LAN_MAILOUT_112", "Send test email to");
|
||||
define("LAN_MAILOUT_113", "Test email from");
|
||||
define("LAN_MAILOUT_114", "This is a test email, it appears that your email settings are working ok! [br][br] Regards [br] from the e107 website system.");
|
||||
define("LAN_MAILOUT_115", "Emailing method");
|
||||
define("LAN_MAILOUT_115", "Bulk Emailing method");
|
||||
define("LAN_MAILOUT_116", "If unsure, leave as php");
|
||||
define("LAN_MAILOUT_117", "complete");
|
||||
define("LAN_MAILOUT_118", "Click on proceed' to start sending emails. Click on 'cancel' to stop the run. Once complete, select another page. Unsent emails cal be viewed through the 'Mailshot status' screen");
|
||||
|
Loading…
x
Reference in New Issue
Block a user