From 68fcb6f81a746243a24144eebe3958b6dc908eb9 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Wed, 11 Jan 2023 19:34:25 +0100 Subject: [PATCH] LSaddon::mail: make optional parameter of sendMail() defaulty null --- src/includes/addons/LSaddons.mail.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/includes/addons/LSaddons.mail.php b/src/includes/addons/LSaddons.mail.php index 16acf686..397cab40 100644 --- a/src/includes/addons/LSaddons.mail.php +++ b/src/includes/addons/LSaddons.mail.php @@ -88,23 +88,24 @@ LSerror :: defineError('MAIL_01', * @param string|array $to Email recipient(s) * @param string $subject Email subject * @param string $msg Email body - * @param array $headers Email headers - * @param array $attachments Email attachments as an array with + * @param array|null $headers Email headers + * @param array|null $attachments Email attachments as an array with * filepath as key and filename as value - * @param string $eol End of line string (default : \n) - * @param string $encoding Email encoding (default: utf8) + * @param string|null $eol End of line string (default : \n) + * @param string|null $encoding Email encoding (default: utf8) * @param boolean $html Set to true to send an HTML email (default: false) * * @author Benjamin Renard * * @return boolean true si MAIL est pleinement supporté, false sinon */ - function sendMail($to, $subject, $msg, $headers=array(), $attachments=array(), - $eol="\n", $encoding="utf8", $html=false) { + function sendMail($to, $subject, $msg, $headers=null, $attachments=null, + $eol=null, $encoding=null, $html=false) { global $MAIL_SEND_PARAMS, $MAIL_HEARDERS, $MAIL_CATCH_ALL; $mail_obj = Mail::factory(MAIL_SEND_METHOD, (isset($MAIL_SEND_PARAMS)?$MAIL_SEND_PARAMS:null)); $logger = LSlog :: get_logger('LSaddon_mail'); + if (!$headers) $headers = array(); if (isset($MAIL_HEARDERS) && is_array($MAIL_HEARDERS)) { $headers = array_merge($headers,$MAIL_HEARDERS); } @@ -155,9 +156,10 @@ LSerror :: defineError('MAIL_01', } } + if (!$encoding) $encoding = "utf8"; $mime = new Mail_mime( array( - 'eol' => $eol, + 'eol' => ($eol?$eol:"\n"), ($html?'html_charset':'text_charset') => $encoding, 'head_charset' => $encoding, )