I am sending SMTP email from my PHP website, using SendGrid SMTP mail service. Everything works fine, but when I send large amounts (5,000), it takes a long time to load/send, then tries to restart over and over again, and doubles, triples,.... I just sent 30,000 emails by mistake! I need a way to see the mail que and delete them or stop the process when it does this.
- How can I see the que of emails to be sent out? Or cancel them from being sent out?
- Maybe through Pearl Mail?
Here is my code
require_once "Mail.php";
$from = $thom5;
$to = $allemailsever1.','.$thom5;
$subject = $_POST['subject1'];
$html = "
<html><body>
<p></p>
$thom
</body></html>
";
$host = "smtp.sendgrid.net";
$port = "587";
$username5 = "";
$password5 = "";
$mime = '1.0';
$content = 'text/html';
$charset="ISO-8859-1";
$three = 'Receipients <'.$thom5.'>';
$headers = array ('From' => $from,
'To' => $three,
'Subject' => $subject,
'Mime-version' => $mime,
'Content-Type' => $content,
'charset' => $charset);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'port' => $port,
'auth' => true,
'username' => $username5,
'password' => $password5));
// Send notification //
$mail = $smtp->send($to, $headers, $html);