A typical sendmail binary (for example, one of the postfix), even if called via PHP mail , opens a synchronous connection with localhost and performs a complete SMTP transaction. This may mean that it is actually slower than using SMTP directly - and in fact postfix docs recommend using SMTP for localhost instead of sendmail if you are looking for performance. In particular, you can use keepalive when sending a large number of messages using SMTP.
One trick is that you can pass an additional sendmail parameter (in particular -O DeliveryMode=b ) so that it works asynchronously, in which case it returns immediately, which makes sending mail more susceptible, but because PHP is not installed to deal with this, you lose the ability to handle errors that may occur, so this is not recommended. You can use this either by calling the sendmail binary with these parameters, or by passing it in the $additional_parameters parameter.
As a rule, on PHPMailer there is no difference between the mail and sendmail parameters, although this can be useful if you want to use the sendmail binary different from the one configured for PHP.
source share