mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-16 15:33:02 +01:00
LSaddon::mail: add possibility to send HTML email
This commit is contained in:
parent
255817d7aa
commit
d6c9e358f3
2 changed files with 12 additions and 6 deletions
|
@ -1,8 +1,10 @@
|
||||||
<sect2 id="config-LSaddon_mail">
|
<sect2 id="config-LSaddon_mail">
|
||||||
<title>LSaddon_mail</title>
|
<title>LSaddon_mail</title>
|
||||||
<para>Cet &LSaddon; est utilisé pour gérer l'envoie de mail. Le module
|
<para>Cet &LSaddon; est utilisé pour gérer l'envoie de mail. Il utilise
|
||||||
&PEAR; Mail doit être installé. Il doit être configuré en éditant son
|
pour cela les librairies &PEAR; <emphasis>Mail</emphasis> et <emphasis>
|
||||||
fichier de configuration <literal>config.LSaddons.mail.php</literal>.</para>
|
Mail_Mime</emphasis> qui doivent être installés. Cet &LSaddon; doit être
|
||||||
|
configuré en éditant son fichier de configuration
|
||||||
|
<literal>config.LSaddons.mail.php</literal>.</para>
|
||||||
|
|
||||||
<programlisting linenumbering="unnumbered">
|
<programlisting linenumbering="unnumbered">
|
||||||
<citetitle>Structure du fichier</citetitle>/*
|
<citetitle>Structure du fichier</citetitle>/*
|
||||||
|
@ -79,6 +81,7 @@ $MAIL_HEARDERS = array(
|
||||||
<paramdef>array <parameter>$attachments</parameter></paramdef>
|
<paramdef>array <parameter>$attachments</parameter></paramdef>
|
||||||
<paramdef>string <parameter>$eol</parameter></paramdef>
|
<paramdef>string <parameter>$eol</parameter></paramdef>
|
||||||
<paramdef>string <parameter>$encoding</parameter></paramdef>
|
<paramdef>string <parameter>$encoding</parameter></paramdef>
|
||||||
|
<paramdef>boolean <parameter>$html</parameter></paramdef>
|
||||||
</funcprototype>
|
</funcprototype>
|
||||||
</funcsynopsis>
|
</funcsynopsis>
|
||||||
</para>
|
</para>
|
||||||
|
|
|
@ -74,7 +74,7 @@ LSerror :: defineError('MAIL_01',
|
||||||
*
|
*
|
||||||
* @retval boolean true si MAIL est pleinement supporté, false sinon
|
* @retval boolean true si MAIL est pleinement supporté, false sinon
|
||||||
*/
|
*/
|
||||||
function sendMail($to, $subject, $msg, $headers=array(), $attachments=array(), $eol="\n", $encoding="utf8") {
|
function sendMail($to, $subject, $msg, $headers=array(), $attachments=array(), $eol="\n", $encoding="utf8", $html=false) {
|
||||||
global $MAIL_SEND_PARAMS, $MAIL_HEARDERS;
|
global $MAIL_SEND_PARAMS, $MAIL_HEARDERS;
|
||||||
$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));
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ LSerror :: defineError('MAIL_01',
|
||||||
$mime = new Mail_mime(
|
$mime = new Mail_mime(
|
||||||
array(
|
array(
|
||||||
'eol' => $eol,
|
'eol' => $eol,
|
||||||
'text_charset' => $encoding,
|
($html?'html_charset':'text_charset') => $encoding,
|
||||||
'head_charset' => $encoding,
|
'head_charset' => $encoding,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -122,7 +122,10 @@ LSerror :: defineError('MAIL_01',
|
||||||
if ($subject)
|
if ($subject)
|
||||||
$mime->setSubject($subject);
|
$mime->setSubject($subject);
|
||||||
|
|
||||||
$mime->setTXTBody($msg);
|
if ($html)
|
||||||
|
$mime->setHTMLBody($msg);
|
||||||
|
else
|
||||||
|
$mime->setTXTBody($msg);
|
||||||
|
|
||||||
if (is_array($attachments) && !empty($attachments)) {
|
if (is_array($attachments) && !empty($attachments)) {
|
||||||
$finfo = new finfo(FILEINFO_MIME_TYPE);
|
$finfo = new finfo(FILEINFO_MIME_TYPE);
|
||||||
|
|
Loading…
Reference in a new issue