Reputation: 253
First, I've seen this question: Send mail without blocking 'execution'
But, I need to know why PHP is not a multi-threading process but has no problem if two people try to connect at the same time.
I am calling the mail script by an Ajax call actually :
$.ajax({
url: 'sendMailTemplate.php',
type: 'POST',
data: formData,
processData: false,
contentType: false,
success: function (data) {}
...
My problem with PHP mailer is that, when I'm sending an email if this takes 10 seconds, then for 10 seconds i can't use any feature of my website ( and the website is like down for everyone for 10 seconds). Should I try to use cron jobs? Is there any tutorial for PHP mailer + cron jobs? What's the best way other than cron jobs?
Upvotes: 1
Views: 674
Reputation: 1320
Should I try to use cron jobs ?
Yes
Is there any tutorial for PHP mailer + cron jobs ?
I tried my own logic by using multiple reference :
Below logic execute like queue and also sending time base on your cronjob & you hrly mailing limit.
"temp_table"
of your database with their "to,cc,bcc,suject,body"
columns."temp_tables"
& send to the recipient. After success full sending, delete those mails from "temp_table"
of you database.Whats the best way other than cron jobs ?
You have contact to your service provider to increase hrly mailing limit, increase your server speed, php.ini : change loading time (this option not works every time), refer different language like python
Upvotes: 1
Reputation: 99
Just switch to a smtpd that allow placing mails in queue and sending them asynchronously.
Upvotes: 0