* * @retval boolean true si MAIL est pleinement supporté, false sinon */ function LSaddon_mail_support() { $retval=true; // Dependance de librairie if (!class_exists('Mail')) { if(!LSsession::includeFile(PEAR_MAIL, true)) { LSerror :: addErrorCode('MAIL_SUPPORT_01'); $retval=false; } } return $retval; } /** * Envoie d'un mail * * @author Benjamin Renard * * @retval boolean true si MAIL est pleinement supporté, false sinon */ function sendMail($to,$subject,$msg,$headers=array()) { global $MAIL_SEND_PARAMS, $MAIL_HEARDERS; $mail_obj = Mail::factory(MAIL_SEND_METHOD, (isset($MAIL_SEND_PARAMS)?$MAIL_SEND_PARAMS:null)); if (isset($MAIL_HEARDERS) && is_array($MAIL_HEARDERS)) { $headers = array_merge($headers,$MAIL_HEARDERS); } if ($subject) { $headers["Subject"] = $subject; } if (!isset($headers['From']) && (LSsession :: getEmailSender() != "")) { $headers['From'] = LSsession :: getEmailSender(); } $headers["To"] = $to; $to = array ( 'To' => $to ); foreach(array_keys($headers) as $header) { if(strtoupper($header) == 'BCC') { $to['BCC'] = $headers[$header]; } elseif(strtoupper($header) == 'CC') { $to['CC'] = $headers[$header]; } } $ret = $mail_obj -> send($to,$headers,$msg); if ($ret instanceof PEAR_Error) { LSerror :: addErrorCode('MAIL_01'); LSerror :: addErrorCode('MAIL_00',$ret -> getMessage()); return; } return true; }