Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #SEND EMAILS
- require '../includes/PHPMailer/PHPMailerAutoload.php';
- require '../includes/PHPMailer/config.php';
- if(isset($_POST['submit'])){
- $mail = new PHPMailer;
- $mail->isSMTP();
- $mail->SMTPAuth = true;
- $mail->Host = $smtp_server_w;
- $mail->Username = $username_w;
- $mail->Password = $password_w;
- $mail->SMTPSecure = "ssl";
- $mail->Port = 465;
- $mail->setFrom("test@test.com", "Test Name");
- $sql_mail = "SELECT * FROM users";
- $run_mail = mysqli_query($conn, $sql_mail);
- while ($row_mail = mysqli_fetch_assoc($run_mail)) {
- $name = $row_mail["user_name"];
- $email = $row_mail["user_email"];
- $mail->ClearAddresses();
- $mail->addAddress('test@test.com', 'Test Name');
- $mail->addBCC($email, $name);
- $mail->isHTML(true); // Set email format to HTML
- $bodyContent = "<p>Multiple Messages</p>";
- $mail->Subject = $row_mail['user_name'].", New job is available " ;
- $mail->Body = $bodyContent;
- $mail->AltBody = $bodyContent;
- if(!$mail->send()) {
- echo "Message could not be sent.";
- $error = '<div class="alert alert-danger"><strong>Mailer Error: '. $mail->ErrorInfo.'</strong></div>';
- } else {
- $error = '<div class="alert alert-success"><strong>Message has been sent</strong></div>';
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement