Advertisement
Guest User

Untitled

a guest
Nov 30th, 2016
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. <?php
  2.  
  3. require_once('phpmailer/class.phpmailer.php');
  4.  
  5. error_reporting( E_ALL & ~E_DEPRECATED & ~E_NOTICE & ~E_STRICT );
  6. $host="mysql.hostinger.in"; // Host name
  7. $username="u831209167_user"; // Mysql username
  8. $password="###"; // Mysql password
  9. $db_name="u831209167_name"; // Database name
  10.  
  11. // Connect to server and select databse.
  12. $con=mysql_connect($host,$username,$password) or die("Can't connect to database!");
  13. mysql_select_db("u831209167_name");
  14.  
  15. $str="SELECT email FROM `notification` ";
  16. $res=mysql_query($str,$con);
  17. while($row=mysql_fetch_array($res))
  18. {
  19.  
  20. $mail = new PHPMailer();
  21. $mail->CharSet = "utf-8";
  22.  
  23. $mail->SMTPAuth = true;
  24. $mail->Username = "###@gmail.com";
  25. $mail->Password = "######";
  26. $mail->SMTPSecure = "ssl";
  27. $mail->Host = "smtp.gmail.com";
  28. $mail->Port = "465";
  29.  
  30. $mail->setFrom('#####@gmail.com', 'example');
  31.  
  32.  
  33. $mail->AddAddress($row[email]);
  34.  
  35. $mail->Subject = '54450065';
  36. $mail->IsHTML(true);
  37.  
  38. $hl = <<<EOL
  39. <h1>Welcome</h1>
  40.  
  41.  
  42. <p>Your username is {$row[email]} .</p>
  43. EOL;
  44.  
  45. $mail->Body = ($hl);
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52. if($mail->Send())
  53. {
  54. echo "Message was Successfully Send :)";
  55. }
  56. else
  57. {
  58. echo "Mail Error - >".$mail->ErrorInfo;
  59. }
  60. }
  61. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement