How to enable persistent SMTP connections in PHPMailer?
I will send many emails, so with persistent connections probably I will get performance gain.
Local Mail Server Limitation Mail() function usually needs local mail server for sending out emails whereas PHPMailer uses SMTP. Also, you should have authentication credentials.
usually this happens because the sending server is already marked as spam by somebody. The way i found is go to the gmail account mark the item as 'important' in gmail and 'Add to Safe senders' in Outlook. Save this answer. Show activity on this post.
PHPMailer doesn't create/use any SQL itself, nor does it have anything to do with javascript, so it's secure on those fronts.
Enable SMTP debugging and set the debug level in your script as follows: $mail->SMTPDebug = 2; level 1 = client; will show you messages sent by the client. level 2 = client and server; will add server messages, it's the recommended setting.
We really don't care here if your server gets blacklisted, right? This is how to achieve what you want. Just set to true
the SMTPKeepAlive
property and after the bulk sending, call implicitly the SmtpClose()
method.
$phpMailer = New PHPMailer();
$phpMailer->isSMTP();
$phpMailer->SMTPKeepAlive = true;
for ( ... ) {
// Send your emails right away
[ ... ]
}
$phpMailer->SmtpClose();
By optimising the sending of emails, you might open yourself up as being identified as spamming and so cause web servers to block your IP.
How many emails are you sending? It may be better to actually throttle emails sent rather than speed up.
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