Ejemplo n.º 1
0
function constructMailer()
{
    $mail = new Mailer();
    $mail->CharSet = 'utf-8';
    $mail->SetLanguage("de");
    $mail->isSMTP();
    $mail->Host = SMTP_SERVER;
    $mail->SMTPAuth = true;
    $mail->Username = SEND_FROM_EMAIL;
    $mail->Password = SEND_FROM_EMAIL_PASSWORD;
    $mail->SMTPSecure = SMTP_SECURE;
    $mail->Port = SMTP_PORT;
    $mail->From = SEND_FROM_EMAIL;
    $mail->FromName = SEND_FROM_EMAIL_NAME;
    $mail->isHTML(true);
    return $mail;
}
Ejemplo n.º 2
0
 public static function MySend($array)
 {
     global $INI, $app;
     if (isset($INI["mailserver"]) && $INI["mailserver"]) {
         $mailer = new Mailer();
         $mailer->isSMTP();
         $mailer->SMTPOptions = ['ssl' => ['verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true]];
         $mailer->Host = $INI["mailserver"];
         if (isset($INI["maildebug"]) && $INI["maildebug"]) {
             $mailer->SMTPDebug = 2;
         }
         if (isset($INI["mailuser"]) && $INI["mailuser"] && isset($INI["mailpwd"]) && $INI["mailpwd"]) {
             $mailer->SMTPAuth = true;
             $mailer->Username = $INI["mailuser"];
             $mailer->Password = $INI["mailpwd"];
             $mailer->Port = $INI["mailport"];
         }
         $mailer->isHTML(true);
         if (is_array($array["from"])) {
             $mailer->setFrom($array["from"][0], $array["from"][1]);
         } else {
             $mailer->setFrom($array["from"]);
         }
         if (is_array($array["to"])) {
             $mailer->addAddress($array["to"][0], $array["to"][1]);
         } else {
             $mailer->addAddress($array["to"]);
         }
         if (isset($array["reply"])) {
             if (is_array($array["reply"])) {
                 $mailer->addReplyTo($array["reply"][0], $array["reply"][1]);
             } else {
                 $mailer->addReplyTo($array["reply"]);
             }
         }
         if (isset($array["bcc"])) {
             if (is_array($array["bcc"])) {
                 foreach ($array["bcc"] as $bcc) {
                     $mailer->addBCC($bcc);
                 }
             } else {
                 $mailer->addBCC($array["bcc"]);
             }
         }
         $mailer->Subject = $array["subject"];
         $mailer->Body = $array["body"];
         if (isset($array["attachments"])) {
             foreach ($array["attachments"] as $a) {
                 $mailer->addAttachment($a);
             }
         }
         $mailer->send();
     } else {
         if (isset($INI["maildebug"]) && $INI["maildebug"]) {
             $file = fopen($app->basePathname("cache/debug.txt"), "a");
             fwrite($file, "Sending to: " . join(" ; ", mklist($array["to"])));
             fwrite($file, "\n{$array['body']}\n----------\n");
             fclose($file);
         }
     }
 }
Ejemplo n.º 3
0
function lostPassword($email)
{
    global $bdd;
    global $_TABLES;
    if (!is_null($bdd) && !is_null($_TABLES)) {
        // Requete de verification de l'existence du compte
        $objUser = new User($bdd, $_TABLES);
        $user = $objUser->getExist($email);
        if ($user && !is_null($user)) {
            // Generation du nouveau mot de passe
            $new_password = random_password();
            // Mise à jour du mot de passe de l'utilisateur
            $objUser->updatePassword($user->id, $new_password);
            // Génération de l'email
            $template = new Template(dirname(dirname(dirname(__FILE__))) . "/ressources/template/email/reset_password.html");
            $content = $template->getView(array("first_name" => $first_name, "last_name" => $last_name, "new_password" => $new_password));
            // Envoi de l'email de bienvenue
            $objMailer = new Mailer();
            $objMailer->from = "*****@*****.**";
            $objMailer->fromName = "Whats Up Street";
            $objMailer->to = $email;
            $objMailer->toName = $first_name . ' ' . $last_name;
            $objMailer->subject = "[Important] Whats Up Street : Changement mot de passe";
            $objMailer->content = $content;
            $objMailer->isHTML();
            $objMailer->send();
            // Retour 0 si tout c'est bien passé
            return 0;
        } else {
            // Compte n'existe pas
            return 1;
        }
    } else {
        error_log("BDD ERROR : " . json_encode($bdd));
        error_log("TABLES ERROR : " . json_encode($_TABLES));
    }
}
Ejemplo n.º 4
0
<?php

require "mailer/class.mailer.php";
$mailer = new Mailer();
$mailer->debug = true;
$mailer->to = "*****@*****.**";
$mailer->toName = "hamzawi";
// $mailer->cci("*****@*****.**") ;
// $mailer->cci("*****@*****.**") ;
$mailer->content = "dernier test :)";
// $mailer->attach("tuto.pdf");
$mailer->confirmTo("*****@*****.**");
//enable HTML containt
$mailer->isHTML();
$mailer->send();