Advertisement
Guest User

Untitled

a guest
May 24th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.29 KB | None | 0 0
  1.  
  2.  
  3. <?php
  4.  
  5.  
  6. require_once('phpmailer/PHPMailerAutoload.php');
  7.  
  8.  
  9. $mail = new PHPMailer(true);
  10.  
  11.  
  12. $mail->IsSMTP(); // Set mailer to use SMTP
  13.  
  14. $mail->Host = 'smtp.gmail.com'; // Specify main and backup server
  15.  
  16. $mail->Port = 465; // Set the SMTP port
  17.  
  18. $mail->SMTPAuth = true; // Enable SMTP authentication
  19.  
  20. $mail->Username = 'email_di_invio@gmail.com'; // SMTP username
  21.  
  22. $mail->Password = 'pssssw'; // SMTP password
  23.  
  24. $mail->SMTPSecure = 'ssl'; // Enable encryption, 'ssl' also accepted
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31. $mail->From = 'email_di_invio@gmail.com';
  32.  
  33. $mail->FromName = 'Email di Invio';
  34.  
  35. // Add a recipient
  36.  
  37. $mail->AddAddress($_POST["email"]); // Indirizzo cliente
  38.  
  39.  
  40. $mail->IsHTML(false);
  41.  
  42. $mail->CharSet = "text/html; charset=UTF-8";
  43.  
  44. $mail->Subject = 'Riepilogo ordine';
  45.  
  46. $mail->Body = $_POST["testo"];
  47.  
  48.  
  49.  
  50. if(!$mail->Send()) {
  51.  
  52. echo 'Message could not be sent.';
  53.  
  54. echo 'Mailer Error: ' . $mail->ErrorInfo;
  55.  
  56. exit;
  57.  
  58. }
  59.  
  60.  
  61. echo 'Message has been sent';
  62.  
  63.  
  64. -------INVIO LA SECONDA EMAIL--------
  65.  
  66. $mail2 = new PHPMailer(true);
  67.  
  68. $mail2->IsSMTP(); // Set mailer to use SMTP
  69.  
  70. $mail2->Host = 'smtp.gmail.com'; // Specify main and backup server
  71.  
  72. $mail2->Port = 465; // Set the SMTP port
  73.  
  74. $mail2->SMTPAuth = true; // Enable SMTP authentication
  75.  
  76. $mail2->Username = 'email_di_invio@gmail.com'; // SMTP username
  77.  
  78. $mail2->Password = 'passsw'; // SMTP password
  79.  
  80. $mail2->SMTPSecure = 'ssl'; // Enable encryption, 'ssl' also accepted
  81.  
  82.  
  83.  
  84. $mail2->From = 'email_di_invio@gmail.com';
  85.  
  86. $mail2->FromName = 'Email di invio';
  87.  
  88. // Add a recipient
  89.  
  90. $mail2->AddAddress('email_mia@gmail.com');
  91.  
  92.  
  93.  
  94. $mail2->IsHTML(false);
  95.  
  96. $mail2->CharSet = "text/html; charset=UTF-8";
  97.  
  98. $mail2->Subject = 'Il tuo ordine';
  99.  
  100. $mail2->Body = $_POST["testo"];
  101.  
  102.  
  103.  
  104. if(!$mail2->Send()) {
  105.  
  106. echo 'Message could not be sent.';
  107.  
  108. echo 'Mailer Error: ' . $mail->ErrorInfo;
  109.  
  110. exit;
  111.  
  112. }
  113.  
  114.  
  115.  
  116. echo 'Message has been sent';
  117.  
  118.  
  119.  
  120. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement