Advertisement
Guest User

Untitled

a guest
Oct 27th, 2016
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.91 KB | None | 0 0
  1. <?php
  2. if(isset($_POST['check']) == true)
  3. {
  4.  
  5. $subject = trim($_POST['subject']);
  6. $message = trim($_POST['message']);
  7. $from = 'testing@test.com';
  8. $i=1;
  9.  
  10. $arrayOne = $_POST['check'];
  11. $arrayTwo = $_POST['fname'];
  12.  
  13.  
  14. $min = min(count($arrayOne), count($arrayTwo));
  15. $result = array_combine(array_slice($arrayOne, 0, $min), array_slice($arrayTwo, 0, $min));
  16.  
  17. foreach($result as $key => $value)
  18. {
  19.  
  20. echo $key. ' '. $value ;
  21.  
  22. ini_set('display_errors',1);
  23. error_reporting(E_ALL);
  24. require 'class.phpmailer.php';
  25. require 'PHPMailerAutoload.php';
  26.  
  27. $mail = new PHPMailer;
  28.  
  29. //$mail->SMTPDebug = 3; // Enable verbose debug output
  30.  
  31.  
  32. $mail->isSMTP(); // Set mailer to use SMTP
  33. $mail->Host = 'smt'; // Specify main/backup SMTP servers
  34. $mail->SMTPAuth = true; // Enable SMTP authentication
  35. $mail->Username = 'com'; // SMTP username
  36. $mail->Password = '4'; // SMTP password
  37. $mail->SMTPSecure = 'tls'; // Enable TLS/SSL encryption
  38. $mail->Port = 587; // TCP port to connect to
  39.  
  40. $mail->From = $from;
  41. $to = $key;
  42. $fornamn = $value;
  43.  
  44.  
  45. $confirm_code=md5(uniqid(rand()));
  46. $pidnew4 = $_POST['pidnew3'];
  47. $pnamnnew4 = $_POST['pnamnnew3'];
  48.  
  49. $mail->IsHTML(true);
  50.  
  51. $mail->CharSet='UTF-8';
  52. $mail->confirm_code=md5(uniqid(rand()));
  53. $mail->FromName = $from;
  54. $mail->addAddress($to);
  55. $mail->Subject = $_POST['subject'];
  56. $mail->Message = $_POST['message'];
  57. $msg = " Test!!";
  58. $mail->Body = $msg;
  59.  
  60.  
  61. $i++;
  62.  
  63. $sql= "INSERT INTO temp_members_db(firstname, confirm_code, email, pid, rid, note) VALUES('$fornamn', '$confirm_code', '$to', '$pidnew4', '$i', '')";
  64. $b = mysqli_query($mysqli,$sql);
  65.  
  66. if(!$mail->send()) {
  67.  
  68. echo 'Message could not be sent.';
  69. echo 'Mailer Error: ' . $mail->ErrorInfo;
  70. } else {
  71.  
  72. echo "<h2>Sent</h2><br><br>
  73.  
  74.  
  75. <br>";
  76. }
  77. }
  78. }
  79.  
  80. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement