mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-10-12 15:04:04 +00:00
sancho mail: added config for haeder/footer image path, renamed custom mail config entries to sancho mail config entries, images are always attached inline (when using Code Igniter)
This commit is contained in:
@@ -34,10 +34,13 @@ $config['validate'] = false; // If true then the email address will be validated
|
|||||||
$config['enable_debug'] = false;
|
$config['enable_debug'] = false;
|
||||||
|
|
||||||
// If to use images for custom mails
|
// If to use images for custom mails
|
||||||
$config['custom_mail_use_images'] = CUSTOM_MAIL_USE_IMAGES;
|
$config['sancho_mail_use_images'] = SANCHO_MAIL_USE_IMAGES;
|
||||||
|
|
||||||
|
// image path for sancho mail, relativ to document root
|
||||||
|
$config['sancho_mail_img_path'] = SANCHO_MAIL_IMG_PATH;
|
||||||
|
|
||||||
// header image for custom mails
|
// header image for custom mails
|
||||||
$config['custom_mail_header_img'] = CUSTOM_MAIL_HEADER_IMG;
|
$config['sancho_mail_header_img'] = SANCHO_MAIL_HEADER_IMG;
|
||||||
|
|
||||||
// footer image for custom mails
|
// footer image for custom mails
|
||||||
$config['custom_mail_footer_img'] = CUSTOM_MAIL_FOOTER_IMG;
|
$config['sancho_mail_footer_img'] = SANCHO_MAIL_FOOTER_IMG;
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ function sendSanchoMail(
|
|||||||
$ci->load->library('email');
|
$ci->load->library('email');
|
||||||
$ci->load->library('MailLib');
|
$ci->load->library('MailLib');
|
||||||
|
|
||||||
$custom_mail_use_images = $ci->config->item('mail');
|
$sancho_mail_use_images = $ci->config->item('mail');
|
||||||
|
|
||||||
|
|
||||||
if ($from == '')
|
if ($from == '')
|
||||||
@@ -66,7 +66,7 @@ function sendSanchoMail(
|
|||||||
$cid_header = '';
|
$cid_header = '';
|
||||||
$cid_footer = '';
|
$cid_footer = '';
|
||||||
|
|
||||||
if (isset($custom_mail_use_images['custom_mail_use_images']) && $custom_mail_use_images['custom_mail_use_images'])
|
if (isset($sancho_mail_use_images['sancho_mail_use_images']) && $sancho_mail_use_images['sancho_mail_use_images'])
|
||||||
{
|
{
|
||||||
$sanchoHeader_img = '';
|
$sanchoHeader_img = '';
|
||||||
$sanchoFooter_img = '';
|
$sanchoFooter_img = '';
|
||||||
@@ -76,10 +76,10 @@ function sendSanchoMail(
|
|||||||
// use provided header image
|
// use provided header image
|
||||||
$sanchoHeader_img = $headerImg;
|
$sanchoHeader_img = $headerImg;
|
||||||
}
|
}
|
||||||
elseif (isset($custom_mail_use_images['custom_mail_header_img']) && $custom_mail_use_images['custom_mail_header_img'])
|
elseif (isset($sancho_mail_use_images['sancho_mail_header_img']) && $sancho_mail_use_images['sancho_mail_header_img'])
|
||||||
{
|
{
|
||||||
// use default header image
|
// use default header image
|
||||||
$sanchoHeader_img = 'skin/images/sancho/'. $custom_mail_use_images['custom_mail_header_img'];
|
$sanchoHeader_img = $sancho_mail_use_images['sancho_mail_header_img'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($footerImg) && $footerImg != '')
|
if (isset($footerImg) && $footerImg != '')
|
||||||
@@ -87,14 +87,29 @@ function sendSanchoMail(
|
|||||||
// use provided footer image
|
// use provided footer image
|
||||||
$sanchoFooter_img = $footerImg;
|
$sanchoFooter_img = $footerImg;
|
||||||
}
|
}
|
||||||
elseif (isset($custom_mail_use_images['custom_mail_footer_img']) && $custom_mail_use_images['custom_mail_footer_img'])
|
elseif (isset($sancho_mail_use_images['sancho_mail_footer_img']) && $sancho_mail_use_images['sancho_mail_footer_img'])
|
||||||
{
|
{
|
||||||
// use default footer image
|
// use default footer image
|
||||||
$sanchoFooter_img = 'skin/images/sancho/'. $custom_mail_use_images['custom_mail_footer_img'];
|
$sanchoFooter_img = $sancho_mail_use_images['sancho_mail_footer_img'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$ci->email->attach($sanchoHeader_img);
|
// add image file paths
|
||||||
$ci->email->attach($sanchoFooter_img);
|
if (isset($sancho_mail_use_images['sancho_mail_img_path']))
|
||||||
|
{
|
||||||
|
if ($sanchoHeader_img != '')
|
||||||
|
{
|
||||||
|
$sanchoHeader_img = $sancho_mail_use_images['sancho_mail_img_path'].$sanchoHeader_img;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($sanchoFooter_img != '')
|
||||||
|
{
|
||||||
|
$sanchoFooter_img = $sancho_mail_use_images['sancho_mail_img_path'].$sanchoFooter_img;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// attach header and footer
|
||||||
|
$ci->email->attach($sanchoHeader_img, 'inline');
|
||||||
|
$ci->email->attach($sanchoFooter_img, 'inline');
|
||||||
$cid_header = $ci->email->attachment_cid($sanchoHeader_img); // sets unique content id for embedding
|
$cid_header = $ci->email->attachment_cid($sanchoHeader_img); // sets unique content id for embedding
|
||||||
$cid_footer = $ci->email->attachment_cid($sanchoFooter_img); // sets unique content id for embedding
|
$cid_footer = $ci->email->attachment_cid($sanchoFooter_img); // sets unique content id for embedding
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -340,11 +340,14 @@ define('DIENSTVERHAELTNIS_SUPPORT', false);
|
|||||||
define('FAS_STUDSTATUS_SHOW_KOMM_PRFG_HINT', false);
|
define('FAS_STUDSTATUS_SHOW_KOMM_PRFG_HINT', false);
|
||||||
|
|
||||||
// header und footer Bilder für eigene Mails verwenden
|
// header und footer Bilder für eigene Mails verwenden
|
||||||
define('CUSTOM_MAIL_USE_IMAGES', true);
|
define('SANCHO_MAIL_USE_IMAGES', true);
|
||||||
|
|
||||||
|
// Pfad für Bilder für eigene Mails, relativ zu document root
|
||||||
|
define('SANCHO_MAIL_IMG_PATH', 'skin/images/sancho/');
|
||||||
|
|
||||||
// header Bild für eigene Mails
|
// header Bild für eigene Mails
|
||||||
define('CUSTOM_MAIL_HEADER_IMG', 'sancho_header_DEFAULT.jpg');
|
define('SANCHO_MAIL_HEADER_IMG', 'sancho_header_DEFAULT.jpg');
|
||||||
|
|
||||||
// footer image for eigene Mails
|
// footer image for eigene Mails
|
||||||
define('CUSTOM_MAIL_FOOTER_IMG', 'sancho_footer_DEFAULT.jpg');
|
define('SANCHO_MAIL_FOOTER_IMG', 'sancho_footer_DEFAULT.jpg');
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -43,30 +43,29 @@ function sendSanchoMail($vorlage_kurzbz, $vorlage_data, $to, $subject, $headerIm
|
|||||||
{
|
{
|
||||||
$from = DEFAULT_SENDER.'@'. DOMAIN;
|
$from = DEFAULT_SENDER.'@'. DOMAIN;
|
||||||
|
|
||||||
$header_image_path_prefix = dirname(__FILE__). '/../skin/images/sancho/';
|
$image_path_prefix = dirname(__DIR__).'/'.(defined('SANCHO_MAIL_IMG_PATH') ? SANCHO_MAIL_IMG_PATH : '');
|
||||||
$footer_image_path_prefix = dirname(__FILE__). '/../skin/images/sancho/';
|
|
||||||
$sanchoHeader_img = '';
|
$sanchoHeader_img = '';
|
||||||
$sanchoFooter_img = '';
|
$sanchoFooter_img = '';
|
||||||
$cid_header = '';
|
$cid_header = '';
|
||||||
$cid_footer = '';
|
$cid_footer = '';
|
||||||
|
|
||||||
if (!defined('CUSTOM_MAIL_USE_IMAGES') || CUSTOM_MAIL_USE_IMAGES)
|
if (!defined('SANCHO_MAIL_USE_IMAGES') || SANCHO_MAIL_USE_IMAGES)
|
||||||
{
|
{
|
||||||
if (isset($headerImg) && $headerImg != '')
|
if (isset($headerImg) && $headerImg != '')
|
||||||
{
|
{
|
||||||
// use provided header image
|
// use provided header image
|
||||||
$sanchoHeader_img = $headerImg;
|
$sanchoHeader_img = $headerImg;
|
||||||
}
|
}
|
||||||
elseif (defined('CUSTOM_MAIL_HEADER_IMG') && CUSTOM_MAIL_HEADER_IMG != '')
|
elseif (defined('SANCHO_MAIL_HEADER_IMG') && SANCHO_MAIL_HEADER_IMG != '')
|
||||||
{
|
{
|
||||||
// use default header image
|
// use default header image
|
||||||
$sanchoHeader_img = CUSTOM_MAIL_HEADER_IMG;
|
$sanchoHeader_img = SANCHO_MAIL_HEADER_IMG;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($sanchoHeader_img != '')
|
if ($sanchoHeader_img != '')
|
||||||
{
|
{
|
||||||
// set full image path
|
// set full image path
|
||||||
$sanchoHeader_img = $header_image_path_prefix.$sanchoHeader_img;
|
$sanchoHeader_img = $image_path_prefix.$sanchoHeader_img;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($footerImg) && $footerImg != '')
|
if (isset($footerImg) && $footerImg != '')
|
||||||
@@ -74,16 +73,16 @@ function sendSanchoMail($vorlage_kurzbz, $vorlage_data, $to, $subject, $headerIm
|
|||||||
// use provided footer image
|
// use provided footer image
|
||||||
$sanchoFooter_img = $footerImg;
|
$sanchoFooter_img = $footerImg;
|
||||||
}
|
}
|
||||||
elseif (defined('CUSTOM_MAIL_FOOTER_IMG') && CUSTOM_MAIL_FOOTER_IMG != '')
|
elseif (defined('SANCHO_MAIL_FOOTER_IMG') && SANCHO_MAIL_FOOTER_IMG != '')
|
||||||
{
|
{
|
||||||
// use default footer image
|
// use default footer image
|
||||||
$sanchoFooter_img = CUSTOM_MAIL_FOOTER_IMG;
|
$sanchoFooter_img = SANCHO_MAIL_FOOTER_IMG;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($sanchoFooter_img !== '')
|
if ($sanchoFooter_img !== '')
|
||||||
{
|
{
|
||||||
// set full image path
|
// set full image path
|
||||||
$sanchoFooter_img = $footer_image_path_prefix.$sanchoFooter_img;
|
$sanchoFooter_img = $image_path_prefix.$sanchoFooter_img;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set unique content id for embedding header and footer image
|
// Set unique content id for embedding header and footer image
|
||||||
|
|||||||
Reference in New Issue
Block a user