Guest User

Untitled

a guest
Mar 26th, 2018
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. <?php
  2. require 'Send_Mail.php';
  3. $var = array("b2.pradeepan@gmail.com","pradeepan.7899@gmail.com","pan6831@gmail.com");
  4.  
  5. for($i=0;$i<$var;$i++)
  6. {
  7. $to = $var[$i];
  8. $subject = "Bulk Mail";
  9. $body = "dummy loop";
  10. $op = Send_Mail($to,$subject,$body);
  11. }
  12. ?>
  13.  
  14. function Send_Mail($to,$subject,$body)
  15. {
  16. require 'class.phpmailer.php';
  17. $from = "XYZ@gmail.com";
  18. $mail = new PHPMailer();
  19. $mail->ClearAllRecipients();
  20. $mail->IsSMTP(true); // SMTP
  21. $mail->SMTPAuth = true; // SMTP authentication
  22. $mail->Mailer = "smtp";
  23. $mail->Host = "tls://smtp.gmail.com"; // Amazon SES server, note "tls://" protocol tls://email-smtp.us-west-2.amazonaws.com
  24. $mail->Port = 465; // set the SMTP port
  25. $mail->Username = "XYZ@gmail.com"; // SES SMTP username
  26. $mail->Password = "XYZ"; // SES SMTP password
  27. $mail->SetFrom($from, 'XYZ@gmail.com');
  28. $mail->AddReplyTo($from,'XYZ@gmail.com');
  29. $mail->Subject = $subject;
  30. $mail->MsgHTML($body);
  31. $mail->clearAllRecipients();
  32. $address = $to;
  33. $mail->AddAddress($address, $to);
  34. if(!$mail->send()) {
  35. $mail->clearAddresses();
  36. return false;
  37. }
  38. else
  39. {
  40. $mail->clearAddresses();
  41. return true;
  42. }
  43. }
Add Comment
Please, Sign In to add comment