Is it possible to send asynchronous emails with phpmailer?
Regular mail sending code snippet is as follows:
$mail->Send();
PHP waits for the Send() to return the result before moving on. Is it possible to have phpmailer to return a result instantly without waiting for the real email sending routine to complete.
PHPMailer can use a non-local mail server (SMTP) if you have authentication. Further advantages include: It can print various kinds of error messages in more than 40 languages when it fails to send an email. It has integrated SMTP protocol support and authentication over SSL and TLS.
PHPMailer does not set any limits, nor does the mail() function, it's only ISPs like GoDaddy that do. However, they do so by blocking access to normal SMTP ports, and/or redirecting SMTP connections to their own servers ( *. secureserver. * ).
PHPMailer is a code library, that is integrated` to send emails securely and effectively by means of PHP code from a web server. Sending emails specifically via PHP code uses a high-level environment to setup SMTP standard convention and related issues and vulnerabilities around Mail infusion for spamming.
The PHPMailer library provides the easiest way to send an email from localhost with an SMTP server using PHP. Not only the text email, but you can also send HTML email from localhost in PHP using PHPMailer.
Update May 2016
As mentioned by user @Sinak Salek PHP does support multithreading. It is available using the pthreads extension.
Original
PHP does not support multithreading natively (which you need to do this beautifully). You can do it though by saving the emails in a database and then process them later using another script (e.g. using a cron job). In this way you don't have to wait for the underlying email framework.
Another thing, if phpmailer is slow it can be due to the underlying mail program (sendmail, postfix etc.) is setup incorrectly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With