Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP Mail function taking 60+ seconds to execute (using sendmail)

So I just moved to a new VPS host and the PHP Mail function basically never ends (although oddly enough it usually sends the email).

I set this in my php.ini: sendmail_path = /usr/sbin/sendmail -i -t

Anyone have any ideas why this would be taking so long? I even set a start/end variable and printed the time in between and it's literally 60 seconds.

Anyone have any ideas?

like image 860
Geesu Avatar asked Nov 05 '22 04:11

Geesu


1 Answers

Mail functions in php is script are slow but 60 sec is too much. Best way is to insert the mail to be sent in Database and send them via cron later (every 2 min). Using Mail queue technique.

like image 145
user1365013 Avatar answered Nov 07 '22 22:11

user1365013