I even tried using Gmail for SMTP as well, but still same thing. I'd hate to see this app go to waste.
Is there some other server or service I could run this though? Or perhaps I can change how I'm sending the message?
I have an array of all my recipients and I'm looping the send. Then just reporting back on the page which ones worked for now. Here's my code:
Code: Select all
function send_email_to_single($everything) {
require_once '../swift/lib/swift_required.php'; //require lib
//Create the Transport
$transport = Swift_MailTransport::newInstance();
$mailer = Swift_Mailer::newInstance($transport) or die('Error creating mailer.');
//Or specify a time in seconds to pause for (30 secs)
$mailer->registerPlugin(new Swift_Plugins_AntiFloodPlugin(50, 30));
foreach ($everything as $single_thing) {
$from = $single_thing[0]; // An array that contains email => name
$recipient = $single_thing[1]; // An array that contains email => name
$body = $single_thing[2];
$text_only = $single_thing[3];
$subject = $single_thing[4];
$message = Swift_Message::newInstance($subject)
->setFrom($from)
->setTo($recipient)
->setBody($body, 'text/html');
if ($mailer->send($message)){
$recieved .= 'success' . $email . '<br />';
} else {
$recieved .= 'error' . $email . '<br />';
}
}
return $recieved;
}