Making phplist able to use more than one smtp-Host

Technical discussion for developers and service providers

Re: Making phplist able to use more than one smtp-Host

Postby jimbo » 8:01pm, Wed 16 Mar, 2011

Still an issue. I had to install 10 different instances of phplist to get a decent delivery. All running 24/7.

The problem is, the "reply to" and "from" address do not match when using the multi SMTP mod.

This guarantees failure/filtration on most email clients / spamwares. Been there again and again.

Filters have become pretty strict.

I can (and have) blast(ed) out thousands an hour :roll: but, to no avail and damage control takes longer than just running at a snails pace.

Other issues exist like only being able to send ~100 per hour to aol (changes from time to time too) or you are blacklisted but, phplist has auto throttle which addresses that issue to a point.

:D PHPLIST is by far the best solution I have found but, multi thread, multipl SMTP servers would put this software well over the top.

WE MUST have a way to send thousands an hour and stay within / adapt to receiving domain rules.

I am currently on a dedicated rackmount xeon server with 6 dedicated ips. My hardware is capable of 250,000 emails an hour no problem. 8) The problem resides in the fact I cannot find software that allows me to send effectively within all domains restrictions.

My temp solution was to set up a reseller account on one of my dedicated ips. Install ten domains and ten instances of phplist all running from the same database. I set up the domain throttling (in config.php) based on the domain I am sending to in each install. :cry:

Since I set up the individual lists per recipients email address domain. I have a list with just aol addresses, a list with just verizon, then comcast addresses and so on until the few oddballs left over are all dumped into the remaining list.

I can then send from each to specific list and they get to where they are going with hardly any failures if plain text is used.

This takes care of "from" and "reply to" mismatch issues, specific / individual domain throttling issues and allows me to send out at a maximum rate only restricted by the receiving domains anti spam criteria.

BUT THIS IS SUCH A PAIN TO MANAGE and hacking around multi connection issues to get it to play nice with mysql was a hair puller but, after over two years of using phplist and tons of experimental configurations and hacks, this is the only configuration that works for me.

Now, multiple SMTP load balancing would help SOOOOO MUCH and the built in domain throttle could just be set to the worst case scenario (aol) or 1 every two minutes. I can see why multi smtp has not been built in, it is a real pain to do it right due to affecting pretty much every stat and connection routine but, I would pay for phplist if these feats were standard.

@DEVELOPERS - How about a free version and an advanced version with multi SMTP load balancing and SPECIFIC domain throttling rules?
PL Nut
Posts: 15
Joined: 7:12pm, Wed 15 Sep, 2010

Re: Making phplist able to use more than one smtp-Host

Postby sen77 » 11:13am, Tue 28 Jun, 2011

hello lygie,

i tried your code.after setting all those things which are mentioned in the forum i got this error (which i have attached here) every time i try to send mail.but in normal code it works fine.I'm using phplist 2.10.14.I have no much knowledge in php as I'm beginner to you have any kind of idea to get rid of this problem.I'm really looking forward to this.......
erro.JPG (43.51 KiB) Viewed 6929 times
phpList newbie
Posts: 1
Joined: 10:55am, Tue 28 Jun, 2011

Re: Making phplist able to use more than one smtp-Host

Postby Dragonrider » 11:23am, Tue 28 Jun, 2011

Error 1064 is covered in this Topic, item 1B, should help.
My sites:-,,,
Latest phpList version is now 3.0.12 (3 February 2015) and requires a minimum of MySQL 5.0 and PHP 5.3.x
Posts: 3460
Joined: 6:58am, Sun 02 Jul, 2006
Location: Ilkley, West Yorkshire, United Kingdom

Re: Making phplist able to use more than one smtp-Host

Postby ludo48 » 12:40pm, Thu 21 Jun, 2012


I tryed this hack but it doesn't work for me. Maybe because I m on Phplist 2.10.18 ?

Could you confirm that, i have to :
1 - config.php
Code: Select all
#if you want do sent email over more than one smtp-Server, uncomment and fill following lines
$smtparray = array(
    "0" => array("hostname"=>"server1.tld","smtp_login"=>"username","smtp_passwd"=>"passwd"),
    "1" => array("hostname"=>"server2.tld","smtp_login"=>"username","smtp_passwd"=>"passwd"),
    "2" => array("hostname"=>"server3.tld","smtp_login"=>"username","smtp_passwd"=>"passwd"),

and comment
Code: Select all
# if you want to use smtp authentication when sending the email uncomment the following
# two lines and set the username and password to be the correct ones
$phpmailer_smtpuser = 'xxxx';
$phpmailer_smtppassword = 'xxxx';;

2 - phplist/Admin/class.phplistmailer.php
Code: Select all
$this->Host = PHPMAILERHOST;
        if ( isset($GLOBALS['phpmailer_smtpuser']) && $GLOBALS['phpmailer_smtpuser'] != ''
             && isset($GLOBALS['phpmailer_smtppassword']) && $GLOBALS['phpmailer_smtppassword']) {
          $this->SMTPAuth = true;
          $this->Username = $GLOBALS['phpmailer_smtpuser'];
          $this->Password = $GLOBALS['phpmailer_smtppassword'];

Code: Select all
$this->Host = $mailhost["hostname"];
  $this->Username = $mailhost["smtp_login"];
  $this->Password = $mailhost["smtp_passwd"];

3 - Sendmail.php
//line 23
function sendEmail ($messageid,$email,$hash,$htmlpref = 0,$rssitems = \
array(),$forwardedby = array()) {
function sendEmail ($smtphost,$messageid,$email,$hash,$htmlpref = 0,$rssitems \
= array(),$forwardedby = array()) {

//line 609:
$mail = new PHPlistMailer($messageid,$destinationemail)
$mail = new PHPlistMailer($messageid,$destinationemail,$smtphost)

4 - processqueue.php

//line 352
$hosts_count = sizeof($smtparray);
$host_divide = 60/$hosts_count;

//line 641
$date_s = date("s");
$host_nr = floor ($date_s/$host_divide);
$smtphost = $smtparray[$host_nr];

//line 647
$success = sendEmail($messageid,$useremail,$userhash,$htmlpref,$rssitems);
$success = sendEmail($smtphost,$messageid,$useremail,$userhash,$htmlpref,$rssitems);

Thaks in advance,
Posts: 6
Joined: 8:26pm, Tue 08 May, 2012


Return to Developers Space

Who is online

Users browsing this forum: No registered users and 1 guest