Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require 'Send_Mail.php';
- $var = array("b2.pradeepan@gmail.com","pradeepan.7899@gmail.com","pan6831@gmail.com");
- for($i=0;$i<$var;$i++)
- {
- $to = $var[$i];
- $subject = "Bulk Mail";
- $body = "dummy loop";
- $op = Send_Mail($to,$subject,$body);
- }
- ?>
- function Send_Mail($to,$subject,$body)
- {
- require 'class.phpmailer.php';
- $from = "XYZ@gmail.com";
- $mail = new PHPMailer();
- $mail->ClearAllRecipients();
- $mail->IsSMTP(true); // SMTP
- $mail->SMTPAuth = true; // SMTP authentication
- $mail->Mailer = "smtp";
- $mail->Host = "tls://smtp.gmail.com"; // Amazon SES server, note "tls://" protocol tls://email-smtp.us-west-2.amazonaws.com
- $mail->Port = 465; // set the SMTP port
- $mail->Username = "XYZ@gmail.com"; // SES SMTP username
- $mail->Password = "XYZ"; // SES SMTP password
- $mail->SetFrom($from, 'XYZ@gmail.com');
- $mail->AddReplyTo($from,'XYZ@gmail.com');
- $mail->Subject = $subject;
- $mail->MsgHTML($body);
- $mail->clearAllRecipients();
- $address = $to;
- $mail->AddAddress($address, $to);
- if(!$mail->send()) {
- $mail->clearAddresses();
- return false;
- }
- else
- {
- $mail->clearAddresses();
- return true;
- }
- }
Add Comment
Please, Sign In to add comment