Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once('phpmailer/class.phpmailer.php');
- error_reporting( E_ALL & ~E_DEPRECATED & ~E_NOTICE & ~E_STRICT );
- $host="mysql.hostinger.in"; // Host name
- $username="u831209167_user"; // Mysql username
- $password="###"; // Mysql password
- $db_name="u831209167_name"; // Database name
- // Connect to server and select databse.
- $con=mysql_connect($host,$username,$password) or die("Can't connect to database!");
- mysql_select_db("u831209167_name");
- $str="SELECT email FROM `notification` ";
- $res=mysql_query($str,$con);
- while($row=mysql_fetch_array($res))
- {
- $mail = new PHPMailer();
- $mail->CharSet = "utf-8";
- $mail->SMTPAuth = true;
- $mail->Username = "###@gmail.com";
- $mail->Password = "######";
- $mail->SMTPSecure = "ssl";
- $mail->Host = "smtp.gmail.com";
- $mail->Port = "465";
- $mail->setFrom('#####@gmail.com', 'example');
- $mail->AddAddress($row[email]);
- $mail->Subject = '54450065';
- $mail->IsHTML(true);
- $hl = <<<EOL
- <h1>Welcome</h1>
- <p>Your username is {$row[email]} .</p>
- EOL;
- $mail->Body = ($hl);
- if($mail->Send())
- {
- echo "Message was Successfully Send :)";
- }
- else
- {
- echo "Mail Error - >".$mail->ErrorInfo;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement