mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-12-18 14:33:49 +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">
|
||||
<title>LSaddon_mail</title>
|
||||
<para>Cet &LSaddon; est utilisé pour gérer l'envoie de mail. Le module
|
||||
&PEAR; Mail doit être installé. Il doit être configuré en éditant son
|
||||
fichier de configuration <literal>config.LSaddons.mail.php</literal>.</para>
|
||||
<para>Cet &LSaddon; est utilisé pour gérer l'envoie de mail. Il utilise
|
||||
pour cela les librairies &PEAR; <emphasis>Mail</emphasis> et <emphasis>
|
||||
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">
|
||||
<citetitle>Structure du fichier</citetitle>/*
|
||||
|
@ -79,6 +81,7 @@ $MAIL_HEARDERS = array(
|
|||
<paramdef>array <parameter>$attachments</parameter></paramdef>
|
||||
<paramdef>string <parameter>$eol</parameter></paramdef>
|
||||
<paramdef>string <parameter>$encoding</parameter></paramdef>
|
||||
<paramdef>boolean <parameter>$html</parameter></paramdef>
|
||||
</funcprototype>
|
||||
</funcsynopsis>
|
||||
</para>
|
||||
|
|
|
@ -74,7 +74,7 @@ LSerror :: defineError('MAIL_01',
|
|||
*
|
||||
* @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;
|
||||
$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(
|
||||
array(
|
||||
'eol' => $eol,
|
||||
'text_charset' => $encoding,
|
||||
($html?'html_charset':'text_charset') => $encoding,
|
||||
'head_charset' => $encoding,
|
||||
)
|
||||
);
|
||||
|
@ -122,7 +122,10 @@ LSerror :: defineError('MAIL_01',
|
|||
if ($subject)
|
||||
$mime->setSubject($subject);
|
||||
|
||||
$mime->setTXTBody($msg);
|
||||
if ($html)
|
||||
$mime->setHTMLBody($msg);
|
||||
else
|
||||
$mime->setTXTBody($msg);
|
||||
|
||||
if (is_array($attachments) && !empty($attachments)) {
|
||||
$finfo = new finfo(FILEINFO_MIME_TYPE);
|
||||
|
|
Loading…
Reference in a new issue