Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Fonction gérant l'envois des mails...
- function sendMailTo($sender, $receiver, $url, $message)
- {
- global $twig;
- $mail = new PHPMailer(true);
- try {
- //Server settings
- // $mail->SMTPDebug = 2;
- $mail->isSMTP();
- $mail->Host = 'smtp.gmail.com';
- $mail->SMTPAuth = true;
- $mail->CharSet = 'UTF-8';
- $mail->Encoding = 'base64';
- $mail->Username = 'swishfile.acs@gmail.com';
- $mail->Password = 'online@2018';
- $mail->SMTPSecure = 'tls';
- $mail->Port = 587;
- //Recipients
- $mail->setFrom('swishfile.acs@gmail.com');
- // Pour le destinataire
- $mail->addAddress($receiver);
- //Content
- $mail->isHTML(true);
- $mail->Subject = 'Une personne vous a envoyé des fichiers';
- $mail->Body = $twig->render('mail.twig', array("url" => $url, "sender" => $sender, "message" => $message));
- $mail->send();
- } catch (Exception $e) {
- echo "ERREUR ! Le message n'a pas été envoyé : ", $mail->ErrorInfo;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement