exit(0);
    }
}
// ENVOI de l'accusé de réception ???
// Paramètres du message
$isSendHTML = true;
// check!
$mail = new OEMail($isSendHTML, $ConfSendMail);
$mail->contact = $contact;
$mail->to = $ReceiptEmail;
// Adresse email de reception
$mail->subject = $LocalizableString->Get($SendMailInfo->ReceiptHeader, $Culture);
// Sujet
$mail->body = $LocalizableString->Get($SendMailInfo->ReceiptBody, $Culture);
// Corps du message
$mail->from = $from;
// Adresse email de l'expediteur (optionnel)
if (!$mail->CheckEmail($ReceiptEmail)) {
    $error = new OEReturn("success", GetErrMessage($objJson, $WEInfoPage, "NoAcknowledgment"));
    //"Impossible d'envoyer l'accusé de réception : e-mail incorrect"
    echo $objJson->Encode($error);
    exit(0);
}
$SendMailReturn = $mail->send();
if ($SendMailReturn != "") {
    $error = new OEReturn("error02", $SendMailReturn);
    echo $objJson->Encode($error);
} else {
    $error = new OEReturn("success", "");
    echo $objJson->Encode($error);
}
Example #2
0
 public static function SendEmailSimple($culture = 'DEFAULT', $ConfSendMail = null, $from = '', $to = '', $cc = '', $subject = '', $body = '', $isHTML = true)
 {
     // returns error description in case of failure
     // when $ConfSendMail = null, at least one SendMail element should be on the page, to use its configuration like send method etc.
     //echo '<br/>SendEmailSimple<br/>';
     if (!class_exists('OEMail')) {
         global $dir_OEDynUtilsphp;
         require_once dirname(dirname($dir_OEDynUtilsphp)) . 'openElement.php';
     }
     if (!class_exists('OEMail') || !class_exists('OEDataLocalizableString')) {
         return false;
     }
     //if (!$to || !$from || (!$subject && !$body)) return false;
     if (!isset($ConfSendMail)) {
         // try to get it from SendMail var data
         global $OEConfWESendMail;
         if (!isset($OEConfWESendMail)) {
             return false;
         }
         // no mail elements found in var file
         $confMail = self::decodeJSON($OEConfWESendMail);
         // find first SendMail element and use its configuration
         foreach ($confMail as $key => $value) {
             $ConfSendMailID = $key;
             break;
         }
         if (!$ConfSendMailID) {
             return false;
         }
         if (!isset($confMail[$ConfSendMailID]['ConfSendMail'])) {
             return false;
         }
         $ConfSendMail = $confMail[$ConfSendMailID]['ConfSendMail'];
     }
     if (!isset($ConfSendMail->TypeStr)) {
         // config stored in array form, conver to object form:
         $ConfSendMail = json_decode(json_encode($ConfSendMail), FALSE);
     }
     $LocalizableString = new OEDataLocalizableString();
     if (!$to) {
     }
     $mail = new OEMail(!!$isHTML, $ConfSendMail);
     $mail->contact = '';
     // $contact
     $mail->from = $from;
     // Adresse email de l'expediteur (optionnel)
     $mail->to = $to;
     $mail->subject = $subject;
     $mail->body = $body;
     // Corps du message
     //echo 'SendMail:';var_dump($mail);
     $r = $mail->send();
     //echo 'SendMail result::';var_dump($r);echo '::';
     if ($r && self::isLocalWebServer()) {
         // emulate mail:
         self::_EmulateSendMail(null, $from, $to, $subject, $body);
         return null;
     }
     return $r ? $r : null;
 }