Serverload using own postfix with mail() vs phpmailer with external smtp

41
April 16, 2019, at 10:20 AM

I got a smaller VPS server at the moment ~20%-30% avg load 3 websites. Clients need to send emails for order, registration, invoices and newsletter.

I told my client because he likes to sent newsletter continuous he should take an external mail service on the domain hoster to reduce server load.

But im not sure, is there any difference in server load - how much if mails got hand over with phpmailer to an external SMTP server vs delivered from own postfix?

Side question: how to fix the timeout I sometimes get sending with phpmailer over external SMTP. (php try - catch ?)

Answer 1

Load should really not be an issue. You can send hundreds of messages per second on even a low-powered server. That said, your other assumptions are correct; you can reduce load by moving services elsewhere, including to other email services.

As far as PHPMailer goes, the code it runs will be identical whether it's local or remote. Using SMTP probably consumes less resources that mail() because all that the mail() function does is open a synchronous SMTP connection to localhost anyway. Generally you should avoid using mail(); it's slower and less safe than SMTP to localhost.

If you're getting intermittent SMTP timeouts, I'd suspect your hosting provider or email host are perhaps throttling your email sending. The right way to deal with that is to run a local mail server (which will deal with queueing and retries asynchronously, and much more efficiently than PHP), and submit messages to it via SMTP to localhost from PHPMailer – PHPMailer is not a mail server. General performance advice can be found in the PHPMailer wiki about sending mail to lists.

READ ALSO
ErrorException htmlspecialchars() expects parameter 1 to be string, array given

ErrorException htmlspecialchars() expects parameter 1 to be string, array given

I want to get data "report_to" from databaseBut i got error when I try to print variable in my view page

28
How to add Attachment field compulsory in WordPress Add to Cart Page [on hold]

How to add Attachment field compulsory in WordPress Add to Cart Page [on hold]

i have added File attachment field in my add to cart page but if someone did not upload their attachment they are still able to place their orderNow i want to make attachment field compulsory that no one place their order successfully without uploading...

42
synchronous dispatching a job how?

synchronous dispatching a job how?

I am developing a multi tenancy app with laravel 58 and I am using this to set related tenant ID for the job but when I dispatch jobs from console like this

25