Advertisement
medmaatar

phpmailer fnc

May 3rd, 2017
617
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. function sendMail2($sujet,$email,$msg)
  2. {
  3. $mail = new PHPMailer();
  4. $mail->IsSMTP(); // send via SMTP
  5. $mail->Host = "ssl://smtp.gmail.com";
  6. $mail->SMTPAuth = true; // turn on SMTP authentication
  7. $mail->Username = "ocean.esprit.tunisie@gmail.com"; // SMTP username
  8. $mail->Password = "a123456789+"; // SMTP password
  9. $webmaster_email = "ocean.esprit.tunisie@gmail.com"; //Reply to this email ID
  10. // Recipients email ID
  11. // Recipient's name
  12. $mail->From = $webmaster_email;
  13. $mail->Port = 465;
  14. $mail->FromName = "ocean team esprit";
  15. $mail->AddAddress($email);
  16. $mail->AddReplyTo($webmaster_email,"ocean team esprit");
  17. $mail->WordWrap = 50; // set word wrap
  18. $mail->IsHTML(true); // send as HTML
  19. $mail->Subject = $sujet;
  20. $mail->Body = $msg; //HTML Body
  21. $mail->AltBody = $msg; //Text Body
  22.  
  23. if(!$mail->Send())
  24. {
  25. echo "Mailer Error: " . $mail->ErrorInfo;
  26. }
  27. else
  28. {
  29. //$_SESSION['flash']['success']='mail sent';
  30. header('location: login.php');
  31. //echo "Message has been sent";
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement