Reputation: 484
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 ?)
Upvotes: 1
Views: 412
Reputation: 37700
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.
Upvotes: 1