sancho default sender konfigurierbar machen

This commit is contained in:
Harald Bamberger
2025-01-28 10:22:30 +01:00
parent e65322965f
commit 39c2e44719
4 changed files with 25 additions and 12 deletions
+3
View File
@@ -33,6 +33,9 @@ $config['validate'] = false; // If true then the email address will be validated
// If enabled will be logged info about emails in Codeigniter error logs
$config['enable_debug'] = false;
// default sender
$config['sancho_mail_default_sender'] = SANCHO_MAIL_DEFAULT_SENDER;
// If to use images for custom mails
$config['sancho_mail_use_images'] = SANCHO_MAIL_USE_IMAGES;
+14 -10
View File
@@ -51,12 +51,16 @@ function sendSanchoMail(
$ci->load->library('email');
$ci->load->library('MailLib');
$sancho_mail_use_images = $ci->config->item('mail');
$sancho_mail_config = $ci->config->item('mail');
if ($from == '')
{
$from = 'noreply@'.DOMAIN;
$from = ((isset($sancho_mail_config['sancho_mail_default_sender'])
&& $sancho_mail_config['sancho_mail_default_sender'])
? $sancho_mail_config['sancho_mail_default_sender']
: 'noreply')
. '@' . DOMAIN;
}
// Embed sancho header and footer image
@@ -66,7 +70,7 @@ function sendSanchoMail(
$cid_header = '';
$cid_footer = '';
if (isset($sancho_mail_use_images['sancho_mail_use_images']) && $sancho_mail_use_images['sancho_mail_use_images'])
if (isset($sancho_mail_config['sancho_mail_use_images']) && $sancho_mail_config['sancho_mail_use_images'])
{
$sanchoHeader_img = '';
$sanchoFooter_img = '';
@@ -76,10 +80,10 @@ function sendSanchoMail(
// use provided header image
$sanchoHeader_img = $headerImg;
}
elseif (isset($sancho_mail_use_images['sancho_mail_header_img']) && $sancho_mail_use_images['sancho_mail_header_img'])
elseif (isset($sancho_mail_config['sancho_mail_header_img']) && $sancho_mail_config['sancho_mail_header_img'])
{
// use default header image
$sanchoHeader_img = $sancho_mail_use_images['sancho_mail_header_img'];
$sanchoHeader_img = $sancho_mail_config['sancho_mail_header_img'];
}
if (isset($footerImg) && $footerImg != '')
@@ -87,23 +91,23 @@ function sendSanchoMail(
// use provided footer image
$sanchoFooter_img = $footerImg;
}
elseif (isset($sancho_mail_use_images['sancho_mail_footer_img']) && $sancho_mail_use_images['sancho_mail_footer_img'])
elseif (isset($sancho_mail_config['sancho_mail_footer_img']) && $sancho_mail_config['sancho_mail_footer_img'])
{
// use default footer image
$sanchoFooter_img = $sancho_mail_use_images['sancho_mail_footer_img'];
$sanchoFooter_img = $sancho_mail_config['sancho_mail_footer_img'];
}
// add image file paths
if (isset($sancho_mail_use_images['sancho_mail_img_path']))
if (isset($sancho_mail_config['sancho_mail_img_path']))
{
if ($sanchoHeader_img != '')
{
$sanchoHeader_img = $sancho_mail_use_images['sancho_mail_img_path'].$sanchoHeader_img;
$sanchoHeader_img = $sancho_mail_config['sancho_mail_img_path'].$sanchoHeader_img;
}
if ($sanchoFooter_img != '')
{
$sanchoFooter_img = $sancho_mail_use_images['sancho_mail_img_path'].$sanchoFooter_img;
$sanchoFooter_img = $sancho_mail_config['sancho_mail_img_path'].$sanchoFooter_img;
}
}
+3
View File
@@ -339,6 +339,9 @@ define('DIENSTVERHAELTNIS_SUPPORT', false);
// Falls Studstatus (Abmeldung, AbmeldungStg, Unterbrechung, Wiederholung) verwendet wird zeige Hinweistext bei Eingabe einer kommissionellen oder zusaetzlichen kommissionellen Pruefung
define('FAS_STUDSTATUS_SHOW_KOMM_PRFG_HINT', false);
// default absender (@DOMAIN wird hinzugefuegt daher ohne angeben)
define('SANCHO_MAIL_DEFAULT_SENDER', 'noreply');
// header und footer Bilder für eigene Mails verwenden
define('SANCHO_MAIL_USE_IMAGES', true);
+5 -2
View File
@@ -24,7 +24,7 @@ require_once(dirname(__FILE__).'/basis_db.class.php');
require_once(dirname(__FILE__).'/mail.class.php');
require_once(dirname(__FILE__).'/vorlage.class.php');
const DEFAULT_SENDER = 'noreply';
const FALLBACK_SENDER = 'noreply';
/**
* Send single Mail with Sancho Design and Layout.
@@ -41,7 +41,10 @@ const DEFAULT_SENDER = 'noreply';
*/
function sendSanchoMail($vorlage_kurzbz, $vorlage_data, $to, $subject, $headerImg = '', $footerImg = '', $replyTo = '', $cc = '')
{
$from = DEFAULT_SENDER.'@'. DOMAIN;
$from = ((defined('SANCHO_MAIL_DEFAULT_SENDER') && SANCHO_MAIL_DEFAULT_SENDER != '')
? SANCHO_MAIL_DEFAULT_SENDER
: FALLBACK_SENDER)
. '@' . DOMAIN;
$image_path_prefix = dirname(__DIR__).'/'.(defined('SANCHO_MAIL_IMG_PATH') ? SANCHO_MAIL_IMG_PATH : '');
$sanchoHeader_img = '';