phpemailpostfix-mtabulkbulk-email

Correct way to save pinging other email server's while bulk emailing?


This is what I am planing to do with my email table . I have setup Postfix on same server .

Separate email column into two columns for example

user@gmail.com

get separated into

Username  |  Hostname
          |
user      |  gmail.com

Now fetching data from database I do sql query order by hostname

foreach($rows as $row)
{
  $data[$row['hostname']][] = $row['username'] . '@' . $row['hostname'];
}

foreach($data as $hostname => $emails)
{
     $list = implode(',',$emails);

      mail($list,'This is subject','Some message');
}

Will doing this save me from pinging each server (like yahoo,google) multiple times ?


Solution

  • You don't have any control over the email delivery from your PHP script. The mail() function only passes the message to your configured transport mechanism and leaves it to handle the delivery however it is configured to. Sorting your mail() calls by hostname gives you no advantage at all.

    On the Postfix end, you might want to read about SMTP connection caching, which seems to pipeline multiple email deliveries over the same connection.