Advertisement
Guest User

Untitled

a guest
Jan 29th, 2019
301
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. <?php
  2.  
  3. require "./include/lib/mailer/PHPMailer.php";
  4. require "./include/lib/mailer/Exception.php";
  5. require "./include/lib/mailer/SMTP.php";
  6.  
  7. use PHPMailer\PHPMailer\PHPMailer;
  8. use PHPMailer\PHPMailer\Exception;
  9.  
  10. function send_mail($email, $oggetto, $messaggio, $path_allegato)
  11. {
  12. $ursername = "latuaemail@asfusf"
  13. $mailpass = "secret :D";
  14.  
  15. $mail = new PHPMailer(true);
  16. try{
  17. $mail->IsSMTP(); // Utilizzo della classe SMTP al posto del comando php mail()
  18. $mail->SMTPAuth = true; // Autenticazione SMTP
  19. $mail->Host = "smtp.gmail.com";
  20. $mail->Port = 465;
  21. $mail->SMTPSecure = 'ssl';
  22. $mail->Username = $username; // Nome utente SMTP autenticato
  23. $mail->Password = $mailpass; // Password account email con SMTP autenticato
  24. $mail->setFrom($username, "WebMaster");
  25. $mail->addAddress($email);
  26. $mail->IsHTML(true);
  27. $mail->Subject = $oggetto;
  28. $mail->Body = $messaggio;
  29. $mail->AltBody = "";
  30. if($mail->Send())
  31. {
  32. return true;
  33. }
  34. else
  35. {
  36. return false;
  37. }
  38. }
  39. catch(Exception $e)
  40. {
  41.  
  42. }
  43. }
  44. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement