mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-22 09:59:06 +01:00
LSaddon::mail: make optional parameter of sendMail() defaulty null
This commit is contained in:
parent
e303706779
commit
68fcb6f81a
1 changed files with 9 additions and 7 deletions
|
@ -88,23 +88,24 @@ LSerror :: defineError('MAIL_01',
|
||||||
* @param string|array<string> $to Email recipient(s)
|
* @param string|array<string> $to Email recipient(s)
|
||||||
* @param string $subject Email subject
|
* @param string $subject Email subject
|
||||||
* @param string $msg Email body
|
* @param string $msg Email body
|
||||||
* @param array<string,string> $headers Email headers
|
* @param array<string,string>|null $headers Email headers
|
||||||
* @param array<string,string> $attachments Email attachments as an array with
|
* @param array<string,string>|null $attachments Email attachments as an array with
|
||||||
* filepath as key and filename as value
|
* filepath as key and filename as value
|
||||||
* @param string $eol End of line string (default : \n)
|
* @param string|null $eol End of line string (default : \n)
|
||||||
* @param string $encoding Email encoding (default: utf8)
|
* @param string|null $encoding Email encoding (default: utf8)
|
||||||
* @param boolean $html Set to true to send an HTML email (default: false)
|
* @param boolean $html Set to true to send an HTML email (default: false)
|
||||||
*
|
*
|
||||||
* @author Benjamin Renard <brenard@easter-eggs.com>
|
* @author Benjamin Renard <brenard@easter-eggs.com>
|
||||||
*
|
*
|
||||||
* @return boolean true si MAIL est pleinement supporté, false sinon
|
* @return boolean true si MAIL est pleinement supporté, false sinon
|
||||||
*/
|
*/
|
||||||
function sendMail($to, $subject, $msg, $headers=array(), $attachments=array(),
|
function sendMail($to, $subject, $msg, $headers=null, $attachments=null,
|
||||||
$eol="\n", $encoding="utf8", $html=false) {
|
$eol=null, $encoding=null, $html=false) {
|
||||||
global $MAIL_SEND_PARAMS, $MAIL_HEARDERS, $MAIL_CATCH_ALL;
|
global $MAIL_SEND_PARAMS, $MAIL_HEARDERS, $MAIL_CATCH_ALL;
|
||||||
$mail_obj = Mail::factory(MAIL_SEND_METHOD, (isset($MAIL_SEND_PARAMS)?$MAIL_SEND_PARAMS:null));
|
$mail_obj = Mail::factory(MAIL_SEND_METHOD, (isset($MAIL_SEND_PARAMS)?$MAIL_SEND_PARAMS:null));
|
||||||
$logger = LSlog :: get_logger('LSaddon_mail');
|
$logger = LSlog :: get_logger('LSaddon_mail');
|
||||||
|
|
||||||
|
if (!$headers) $headers = array();
|
||||||
if (isset($MAIL_HEARDERS) && is_array($MAIL_HEARDERS)) {
|
if (isset($MAIL_HEARDERS) && is_array($MAIL_HEARDERS)) {
|
||||||
$headers = array_merge($headers,$MAIL_HEARDERS);
|
$headers = array_merge($headers,$MAIL_HEARDERS);
|
||||||
}
|
}
|
||||||
|
@ -155,9 +156,10 @@ LSerror :: defineError('MAIL_01',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$encoding) $encoding = "utf8";
|
||||||
$mime = new Mail_mime(
|
$mime = new Mail_mime(
|
||||||
array(
|
array(
|
||||||
'eol' => $eol,
|
'eol' => ($eol?$eol:"\n"),
|
||||||
($html?'html_charset':'text_charset') => $encoding,
|
($html?'html_charset':'text_charset') => $encoding,
|
||||||
'head_charset' => $encoding,
|
'head_charset' => $encoding,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue