Hi,guys i have a problem, when i send some emails i don`t have any problems ,but i want send 1000 emails with swiftmailer , all emails diferent and to people diferent.
This:
public function SendAll($AMessages)
{
foreach ($AMessages as $Result)
{
Yii::$app->mailer->compose()
->setTo($Player->email)
->setFrom([Yii::$app->params["adminEmail"] => Yii::$app->params["title"]])
->setSubject($Result['Subject'])
->setHtmlBody($Result['Content'])
->send();
}
return 1;
}
As I understand it, you are trying to send 500 unique e-mail messages at one time…
And you don’t like that it takes one minute…
If you are using a standard SMTP server setup from a hosting company ( as opposed to a dedicated e-mail company ), that is really not bad.
That is a little over 8 e-mails a second. For each e-mail your server has to connect to the SMTP server, authorize the connection, send the message details and close the connection. Many SMTP servers are not configured to handle a large inrush of messages at one time, and may throttle incoming messages.
MailChimp will not do what you want. It is designed to send the same message to LOTS of people. Probably what you would want to use would be something like Mailchimp’s Mandrill.
The Mandrill website has a page that talks a lot more about this.