Exemple #1
0
 private static function mailjetMail($reply, $to, $objet, $content, $attachments)
 {
     require_once ROOT . 'phpmailer/class.phpmailer.php';
     $mail = new PHPmailer();
     $mail->CharSet = CHARSET;
     $mail->IsSMTP();
     $mail->Host = "in.mailjet.com";
     $mail->SMTPAuth = true;
     // Si votre serveur requiert une authentification.
     $mail->SMTPSecure = 'ssl';
     $mail->Port = 25;
     $mail->Username = "******";
     $mail->Password = "******";
     $mail->IsHTML(true);
     $mail->From = $reply;
     $mail->FromName = 'Route des Vins de bordeaux, graves et sauternes';
     $mail->AddAddress($to);
     // recepteur
     $mail->AddReplyTo($reply);
     $mail->Subject = $objet;
     $mail->Body = $content;
     foreach ($attachments as $cid => $attachment) {
         $mail->AddEmbeddedImage($attachment['file'], $cid, $attachment['name']);
     }
     if (!$mail->Send()) {
         print_r($mail->ErrorInfo);
     }
 }
Exemple #2
0
    require "../PHPMailer/class.phpmailer.php";
    //istanziamo la classe
    $messaggio = new PHPmailer();
    $messaggio->IsSMTP();
    $messaggio->SMTPDebug = 1;
    $messaggio->SMTPAuth = true;
    $messaggio->Host = 'smtp.gmail.com';
    $messaggio->Port = 465;
    $messaggio->SMTPSecure = 'ssl';
    $messaggio->Username = "******";
    $messaggio->Password = "******";
    //definiamo le intestazioni e il corpo del messaggio
    $messaggio->From = '*****@*****.**';
    $messaggio->FromName = "Support Team CipChat";
    $messaggio->AddAddress($email);
    $messaggio->AddReplyTo('*****@*****.**');
    $messaggio->Subject = 'Attivazione CipChat';
    $messaggio->Body = stripslashes("Codice di attivazione: {$code}");
    //definiamo i comportamenti in caso di invio corretto
    //o di errore
    if (!$messaggio->Send()) {
        echo $messaggio->ErrorInfo;
    } else {
        echo 'Email inviata correttamente!';
    }
    //chiudiamo la connessione
    $messaggio->SmtpClose();
    unset($messaggio);
    mysql_close($connessione);
    //per chiudere la connessione al DBMS
}
Exemple #3
0
function mailpmb($to_nom = "", $to_mail, $obj = "", $corps = "", $from_name = "", $from_mail, $headers, $copie_CC = "", $copie_BCC = "", $faire_nl2br = 0, $pieces_jointes = array(), $reply_name = "", $reply_mail = "")
{
    global $opac_mail_methode, $opac_mail_html_format, $opac_mail_adresse_from;
    global $charset;
    if (!is_array($pieces_jointes)) {
        $pieces_jointes = array();
    }
    $param = explode(",", $opac_mail_methode);
    if (!$param) {
        $param = array();
    }
    $mail = new PHPmailer();
    $mail->CharSet = $charset;
    if ($copie_CC) {
        $destinataires_CC = explode(";", $copie_CC);
    } else {
        $destinataires_CC = array();
    }
    if ($copie_BCC) {
        $destinataires_BCC = explode(";", $copie_BCC);
    } else {
        $destinataires_BCC = array();
    }
    $destinataires = explode(";", $to_mail);
    switch ($param[0]) {
        case 'smtp':
            // $pmb_mail_methode = méthode, hote:port, auth, name, pass
            $mail->IsSMTP();
            $mail->Host = $param[1];
            if ($param[2]) {
                $mail->SMTPAuth = true;
                $mail->Username = $param[3];
                $mail->Password = $param[4];
                if ($param[5]) {
                    $mail->SMTPSecure = $param[5];
                }
                // pour traitement connexion SSL
            }
            break;
        default:
        case 'php':
            $mail->IsMail();
            $to_nom = "";
            break;
    }
    if ($opac_mail_html_format) {
        $mail->IsHTML(true);
    }
    if (trim($opac_mail_adresse_from)) {
        $tmp_array_email = explode(';', $opac_mail_adresse_from);
        $mail->From = $tmp_array_email[0];
        if (isset($tmp_array_email[1])) {
            $mail->FromName = $tmp_array_email[1];
        }
    } else {
        $mail->From = $from_mail;
        $mail->FromName = $from_name;
    }
    for ($i = 0; $i < count($destinataires); $i++) {
        $mail->AddAddress($destinataires[$i], $to_nom);
    }
    for ($i = 0; $i < count($destinataires_CC); $i++) {
        $mail->AddCC($destinataires_CC[$i]);
    }
    for ($i = 0; $i < count($destinataires_BCC); $i++) {
        $mail->AddBCC($destinataires_BCC[$i]);
    }
    if ($reply_mail && $reply_name) {
        $mail->AddReplyTo($reply_mail, $reply_name);
    } else {
        $mail->AddReplyTo($from_mail, $from_name);
    }
    $mail->Subject = $obj;
    if ($opac_mail_html_format) {
        if ($faire_nl2br) {
            $mail->Body = wordwrap(nl2br($corps), 70);
        } else {
            $mail->Body = wordwrap($corps, 70);
        }
    } else {
        $corps = str_replace("<hr />", PHP_EOL . "*******************************" . PHP_EOL, $corps);
        $corps = str_replace("<hr />", PHP_EOL . "*******************************" . PHP_EOL, $corps);
        $corps = str_replace("<br />", PHP_EOL, $corps);
        $corps = str_replace("<br />", PHP_EOL, $corps);
        $corps = str_replace(PHP_EOL . PHP_EOL . PHP_EOL, PHP_EOL . PHP_EOL, $corps);
        $corps = strip_tags($corps);
        $corps = html_entity_decode($corps, ENT_QUOTES, $charset);
        $mail->Body = wordwrap($corps, 70);
    }
    for ($i = 0; $i < count($pieces_jointes); $i++) {
        if ($pieces_jointes[$i]["contenu"] && $pieces_jointes[$i]["nomfichier"]) {
            $mail->AddStringAttachment($pieces_jointes[$i]["contenu"], $pieces_jointes[$i]["nomfichier"]);
        }
    }
    if (!$mail->Send()) {
        $retour = false;
        global $error_send_mail;
        $error_send_mail[] = $mail->ErrorInfo;
        // echo $mail->ErrorInfo."<br /><br /><br /><br />";
        // echo $mail->Body ;
    } else {
        $retour = true;
    }
    if ($param[0] == 'smtp') {
        $mail->SmtpClose();
    }
    unset($mail);
    return $retour;
}
Exemple #4
0
<?php

header("Access-Control-Allow-Origin: *");
require "phpmailer/class.phpmailer.php";
$path_parts = pathinfo($_FILES['userfile']['name']);
$mail = new PHPmailer();
$mail->SMTPAuth = false;
$mail->IsHTML(true);
$mail->From = $_POST['from'];
$mail->AddAddress($_POST['destinataire']);
//$mail->AddAddress($_POST['from']);
$mail->AddReplyTo($_POST['from']);
error_log("from:" . $_POST['from']);
if (isset($_FILES['userfile'])) {
    $mail->AddAttachment($_FILES['userfile']['tmp_name'], 'photo.' . substr($path_parts['extension'], 0, 3));
}
$mail->Subject = "Message envoyé depuis l'application L'Autre Radio " . date('d/m/Y') . " à " . date('G:i');
$mail->Body = '	Bonjour,
					<p>Message envoyé le ' . date('d/m/Y') . ' à ' . date('G:i') . ' depuis l\'application L\'Autre Radio</p>
					<p>Informations de la personne :</p>
					<div><strong>Nom :</strong> ' . $_POST['nom'] . '</div>
					<div><strong>Email :</strong> ' . $_POST['mail'] . '</div>
					<div><strong>Mobile :</strong> ' . $_POST['mobile'] . '</div>
					<div><strong>Message :</strong> ' . $_POST['message'] . '</div>';
if (!$mail->Send()) {
    $messageError1 = $mail->ErrorInfo;
} else {
    $messageError1 = 'Mail envoyé avec succès';
}
unset($mail);
error_log("retour:" . $messageError1);
Exemple #5
0
                            $user_to_send_email = mysql_fetch_array($requser);
                            $email_to_send = $user_to_send_email[mail];
                            $requete = "DELETE FROM tusers WHERE id = '{$_GET['id']}'";
                            $execution = mysql_query($requete) or die('Erreur SQL !<br /><br />' . mysql_error());
                            require "components/PHPMailer_v5.1/class.phpmailer.php";
                            $mail = new PHPmailer();
                            $mail->CharSet = 'UTF-8';
                            //UTF-8 possible if characters problems
                            //$mail->IsMail();
                            $mail->IsSendmail();
                            $mail->IsHTML(true);
                            // Envoi en html
                            $mail->From = "{$rparameters['mail_from']}";
                            $mail->FromName = "{$rparameters['mail_from']}";
                            $mail->AddAddress($email_to_send);
                            $mail->AddReplyTo("{$rparameters['mail_from']}");
                            $mail->Subject = "Compte rejeter";
                            $bodyMSG = "Bonjour , <br /><br />\r\n         Votre compte a été supprimé par le système, nous reprenons contact avec vous dès que possible. <br /><br />\r\n         Nous restons à votre disposition pour tout renseignement complémentaire.  <br /><br />\r\n         Bien à vous\r\n         ";
                            $mail->Body = utf8_encode("{$bodyMSG}");
                            $mail->Send();
                            $mail->ClearAddresses();
                            $www = "./index.php?page=admin&subpage=user&profileid=ND";
                            echo '<script language="Javascript">
			<!--
			document.location.replace("' . $www . '");
			// -->
			</script>';
                        } else {
                            ?>
	<?php 
                            $sql = "Select * From `tcompany`";
Last update: 21/11/2012
*/
// initialize variables
require "components/PHPMailer_v5.1/class.phpmailer.php";
$mail = new PHPmailer();
$mail->CharSet = 'ISO-8859-1';
//UTF-8 possible if characters problems
//$mail->IsSMTP();
$mail->IsSendmail();
//$mail->Host = "$rparameters[mail_smtp]";
//$mail->SMTPAuth = $rparameters['mail_auth'];
//if ($rparameters['mail_secure']=='465') $mail->SMTPSecure = 'ssl';
//if ($rparameters['mail_secure']=='587') $mail->SMTPSecure = 'tls';
//if ($rparameters['mail_secure']=='465') $mail->Port = 465;
//if ($rparameters['mail_secure']=='587') $mail->Port = 587;
$mail->Username = "******";
$mail->Password = "******";
$mail->IsHTML(true);
// Envoi en html
$mail->From = "{$from}";
$mail->FromName = "{$from}";
$mail->AddAddress("{$to}");
$mail->AddReplyTo("{$from}");
$mail->Subject = "{$object}";
$mail->Body = "{$message}";
if (!$mail->Send()) {
    echo '<div id="erreur"><img src="./images/access.png" alt="erreur" style="border-style: none" alt="img" />';
    echo $mail->ErrorInfo;
    echo '</div>';
}
//$mail->SmtpClose();
Exemple #7
0
 //	$mail->Host = "$rparameters[mail_smtp]";
 //	$mail->SMTPAuth = $rparameters['mail_auth'];
 //	if ($rparameters['mail_secure']=='465') $mail->SMTPSecure = 'ssl';
 //	if ($rparameters['mail_secure']=='587') $mail->SMTPSecure = 'tls';
 //	if ($rparameters['mail_secure']=='465') $mail->Port = 465;
 //	if ($rparameters['mail_secure']=='587') $mail->Port = 587;
 $mail->Username = "******";
 $mail->Password = "******";
 $mail->IsHTML(true);
 // Envoi en html
 // add picture
 // $mail->AddEmbeddedImage("chemin_image", "non_image", "cid_image");
 $mail->From = "demande.me";
 $mail->FromName = "{$rparameters['mail_from']}";
 $mail->AddAddress("{$userrow['mail']}");
 $mail->AddReplyTo("{$techrow['mail']}");
 $mail->AddCC("{$rparameters['mail_cc']}");
 if ($_POST['usercopy'] != '') {
     $mail->AddCC("{$_POST['usercopy']}");
 }
 if ($_POST['usercopy2'] != '') {
     $mail->AddCC("{$_POST['usercopy2']}");
 }
 if ($_POST['usercopy3'] != '') {
     $mail->AddCC("{$_POST['usercopy3']}");
 }
 if ($_POST['usercopy4'] != '') {
     $mail->AddCC("{$_POST['usercopy4']}");
 }
 if ($globalrow['img1'] != '') {
     $mail->AddAttachment("./upload/{$_GET['id']}/{$globalrow['img1']}");
Exemple #8
0
    public function sendInvitation(Invite $invitation, Users $user, Profile $profile)
    {
        $this->from = $user->getMail();
        $this->subject = "Vous êtes invité sur TIPKIN";
        $this->content = '
<p>Bonjour, <br/><br/>
								' . $profile->getFirstname() . " " . $profile->getLastname() . " vous invite à rejoindre sa communauté sur Tipkin :\n\t\t\t\t\t\t\t\t<br/><br/>\n\t\t\t\t\t\t\t\t<q>Si tu ne connais pas encore Tipkin, connecte-toi, et rejoints ma Tipkin-ship !<br/>\nEnsemble nous pourrons partager tous nos objets.\t\t\t\t\t\t\t\t<br />\n  N'hésites plus et viens consulter mes annonces sur mon profil <a href='" . $this->serverName . "users/member/" . $profile->getUserId() . "'>" . $user->getUsername() . "</a><br/>\n  " . $invitation->commentaire . "</q><br/><br/>\n\t\t\t\t\t\t\t\tRejoignez le mouvement de la consommation collaborative!<br />\n\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\tA tout de suite sur <a href=" . $this->serverName . ">TIPKIN</a> ! <br /><br/>Je possède. Tu empruntes. Nous partageons !\n\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\tL'équipe TIPKIN.</p>\n\t\t\t\t\t\t\t\t";
        $email_error = FALSE;
        $invitation->explodeEmailsListe();
        $this->replaceContentKeywords();
        $mail = new PHPmailer();
        //        $mail->IsSMTP();
        $mail->IsSendMail();
        //$mail->SMTPDebug=true;    //permet de voir les erreurs si ça ne fonctionne pas
        $mail->Host = ini_get('SMTP');
        // Connexion au serveur SMTP
        $mail->Port = 25;
        //$mail->SMTPAuth = true; // Cette partie est optionnelle si le serveur SMTP n'a pas besoin d'authentification
        //$mail->Username = '******'; // mettre l'adresse email que founit l'hébergeur
        //$mail->Password = '******'; // le mot de passe pour se connecter à votre boite mail sur l'hébergeur
        $mail->IsHTML(true);
        // Permet d'écrire un mail en HTML (=> conversion des balises
        $mail->CharSet = 'UTF-8';
        // évite d'avoir des caractères chinois :)
        $mail->From = '*****@*****.**';
        // adresse mail du compte qui envoi
        $mail->AddReplyTo($this->from);
        $mail->FromName = "L'équipe TIPKIN";
        // remplace le nom du destinateur lors de la lecture d'un email
        $mail->Subject = $this->subject;
        // l'entête = nom du sujet
        $mail->Body = $this->content;
        // le corps = le message en lui-même, codé en HTML si vous voulez
        //$adresses = explode(",", $this->to);
        $invitation->email_error = FALSE;
        $invitation->email_sent = FALSE;
        foreach ($invitation->getEmailsliste() as $email) {
            $mail->AddAddress($email);
            // adresse du destinataire, plusieurs adresses possibles en même temps !
            $Syntaxe = '#^[\\w.-.+]+@[\\w.-]+\\.[a-zA-Z]{2,6}$#';
            if (preg_match($Syntaxe, $email)) {
                $checkemail = true;
            } else {
                $checkemail = false;
            }
            /*$checkemail=FALSE;
            		if(filter_var($email, FILTER_VALIDATE_EMAIL)){
               			$checkemail=TRUE;
            		}
            		*/
            if (!$mail->Send() || !$checkemail) {
                $_REQUEST['error'] = $mail->ErrorInfo;
                // affiche une erreur => pas toujours explicite
                $error_flag = TRUE;
                $invitation->email_error[] = $email;
            } else {
                $invitation->email_sent[] = $email;
            }
            $mail->ClearAddresses();
        }
        $mail->SmtpClose();
        unset($mail);
        // ferme la connexion smtp et désalloue la mémoire...
        return $email_error;
    }