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;
}
}