lobibull.blogg.se

Php massive mail template
Php massive mail template






  1. PHP MASSIVE MAIL TEMPLATE HOW TO
  2. PHP MASSIVE MAIL TEMPLATE CODE

$message->AddAlternativeMultipart( $alternative_parts) $alternative_parts = array($text_part, $html_part) * Assemble the text and HTML parts as alternatives $message-> CreateQuotedPrintableHtmlPart( $html, '', $html_part ) * Create a place holder HTML message body part $message-> CreateQuotedPrintableTextPart( $text, '', $text_part ) * Create a place holder text message body part $message->SetEncodedHeader('Subject', 'Some subject') Here is a sample message delivery loop for sending messages with the same body to many recipients:

php massive mail template

The MIME message class has a variable named cache_body that when set to true it tells the class to cache the assembled body of the message when it sends it to the first recipient, so it avoids the overhead of reassembling the message for subsequent recipients. This means that the message body is the same, only the message headers may vary from recipient to recipient. The simplest case of mass mailing is of newsletters that have the same body content for all recipients. This class is suitable for use when you are running PHP on a server that has Sendmail or another compatible mail server like Postfix, Qmail, Exim, etc.īulk Email Sender PHP Script Optimized for Newsletters with the Same Body for All Recipients

PHP MASSIVE MAIL TEMPLATE CODE

Here is sample code to initialize the sendmail_message_class in preparation for mass mailing. In the case of the qmail_message_class the SetBulkMail function does not make a difference because qmail always stores messages in the local queue instead of attempting to send it to the destination SMTP server immediately. In the case of the sendmail_message_class it sets the delivery_mode variable to a value that tells the sendmail email server to store the message in a local queue instead of waiting to deliver the message to the destination SMTP server. This avoids the overhead of closing and reopening the SMTP server connection. However for specific sub-classes like the smtp_message_class that uses a SMTP server, it prevents the class to close the connection with the server between sending messages to two recipients. In this case the SetBulkMail does not do anything.

php massive mail template

The base class email_message_class uses the PHP mail() function to deliver the message. What this function does in practice depends on the actual way the message is sent. It hints the class to prepare itself to send many messages, one after another. One optimization that this class provides for mass mailing is the SetBulkMail function. That is the case of sites that need to send newsletters or other types of mass mailings. Very often PHP applications need to send messages to many users.

PHP MASSIVE MAIL TEMPLATE HOW TO

How to Build a Bulk Email Sending Application in PHP This MIME message class uses as much as possible many of those functions to compose and send email with great efficiency. This factor makes PHP suitable for performing many types of heavy duty tasks like for instance sending email messages to many recipients.Īs a matter of fact PHP comes built-in with many functions specifically to encode data to compose email standards compliant messages very efficiently. PHP acts only as glue language that passes data to those C functions. That factor is that PHP provides many functions that can process large amounts of data and the speed of lower level languages such as C and C++.Īs a matter of fact those functions are written in C, rather than PHP code that is compiled into byte code. However, there is a factor that makes PHP even run much faster for heavy duty tasks. This fact makes PHP code execute much faster than many developers imagine.

php massive mail template

Only after the compilation process PHP is executed by the Zend Engine. Instead PHP is compiled into byte code before executing just like other languages, such as Java and C#. Since PHP 4.0 when Zend Engine 1 was introduced, PHP source code is not interpreted during execution. The fact that most PHP applications run directly from PHP source code makes many developers believe that PHP is necessarily slow because it needs to interpret the source code to be executed. PHP and the Myth of the Slow Interpreted Language








Php massive mail template