View Issue Details

IDProjectCategoryView StatusLast Update
0016679phpList 3 applicationEmailpublic23-10-12 16:25
Reporterduncanc Assigned To 
Status resolvedResolutionfixed 
Product Version2.11.7 
Target Version2.11.8Fixed in Version2.11.8 
Summary0016679: New install of 2.11.7 cannot send mail
DescriptionInstalled release 2.11.7 from scratch.
Sending a test message fails with "Could not connect to SMTP host."

This is odd because the default is to send using the php mail() function.

Looking into the problem, it it caused by the, presumably incorrect, definition of PHPMAILERTESTHOST in init.php. The constructor of PHPlistMailer then decides to send using SMTP and an empty host name instead of using the php mail() function.
Steps To ReproduceInstall 2.11.7 from scratch or just use a default config.php file.
TagsNo tags attached.


has duplicate 0016685 resolvedmichiel Can't add new subscriber 



03-09-12 15:42

administrator   ~0051717

ah, good one.


12-10-12 02:03

reporter   ~0051741

Got the same problem.
That is the reason for which I have not worked on it.
Some servers do not allow using smtp.


12-10-12 02:53

administrator   ~0051742

yes, I decided to allow separation of testing and sending to different hosts.

should be quite easy to fix, if anyone has the patch, appreciated.


12-10-12 18:40

updater   ~0051743

It's difficult to provide a patch because it is unclear to me what these extra defines are actually for:

They are defined in init.php and used only in the phplistmailer constructor, but I don't see what they are actually for.

I guess that the logic is meant to be along the lines

if PHPMAILERBLASTHOST is defined and not empty then use that for the SMTP server
else if PHPMAILERTESTHOST is defined and not emtpy then use that for the SMTP server
else if PHPMAILERHOST is defined and not empty then use that for the SMTP server
else use the php mail() function

but that seems over-elaborate. Why have three possible definitions of the server when one will do?

Can you clarify what the intention is, as I expect you wrote the code?


12-10-12 20:25

administrator   ~0051744

the idea is to be able to separate the smtp host for sending tests vs the one on sending the actual campaign.

that's mostly because the test is sent "interactively" ie with a person doing something and the blast isn't (and therefore failure isn't too bad, it can simply try again the next time).

I think setting it to be PHPMAILERHOST is the easiest. But if it's unclear, I'll try to sort it out in a next coding session.


13-10-12 18:58

updater   ~0051745

OK, I think I understand what you mean. I made a few changes to the code and two problems came up
Firstly, while there are three definitions of the SMTP server, there is only one set of SMTP authentication user id and password. So if one server needs authentication then the others need to as well, with the same user id and password.

A more basic problem is that the parameter $isBlast is never set to true, even when the message queue is being processed. Function sendEmail() in sendemaillib calls the phplistmailer constructor with false, but that function doesn't know whether it has been called to send a test message or a message queue.
My suggested solution is to add an extra parameter to sendEmail() which is then passed to the constructor of phplistmailer. The caller of sendEmail() knows which context it is in.

But this seems a lot of fuss for a feature that can be simulated by having multiple definitions in the config.php file and uncommenting the one you want.


18-10-12 10:50

reporter   ~0051754

Is there any fix out there, that i can use to get it working either with smtp or php mail() function?
this problem prevents new subscribers from subcribing to a list, as the error occurs also when phplist tries to send the email with the activiation link.

If someone could tell me how get it working, even if its not the final patch for the next version, I'd appreaciate it very much.

PS: I tried fixing it myself, but had no luck..


18-10-12 11:20

updater   ~0051755

I have just added a topic to the forum explaining how to work around this problem. See


22-10-12 21:34

reporter   ~0051763

Im not sure if this is the same issue of not, but my install of 2.11.7 can send test emails via sendgrid smtp service, but does not send real campaigns. It goes to the processing and says "Less than batch size were sent, so reloading imminently".

The log says (oldest to newest):
*Processing has started, 1 message(s) to process.
*Please leave this window open. You have batch processing enabled, so it will reload several times to send the messages. Reports will be sent by email to [email redacted]
*Processing message 26
*Looking for subscribers
*Found them: 5 to process
*Processed 5 out of 5 users
*Finished this run
*Less than batch size were sent, so reloading imminently
*Processed 0 out of 0 users
*Hmmm, No subscribers found to send to
*It took 11 secs to send this message

I cleared the log before testing so this is all one test.
It appears to acknowledge the 5 subscribers correctly but in processing removes them before actually sending them.
If there are any debug settings or anything i can turn on to get more logs id be happy to fetch them.


23-10-12 15:40

administrator   ~0051764

to fix this:

in "class.phplistmailer.php" change line

      } elseif (!$this->inBlast && defined('PHPMAILERTESTHOST')) {

to say

      } elseif (!$this->inBlast && defined('PHPMAILERTESTHOST') && PHPMAILERTESTHOST != '') {

on my system line 81, but that may be different


23-10-12 15:46

administrator   ~0051765

sorry, and additionally change line

      if ($this->inBlast && defined('PHPMAILERBLASTHOST') && defined('PHPMAILERBLASTPORT')) {

to say

      if ($this->inBlast && defined('PHPMAILERBLASTHOST') && defined('PHPMAILERBLASTPORT') && PHPMAILERBLASTHOST != '') {


23-10-12 15:50

administrator   ~0051766

by the way, the comment "A more basic problem is that the parameter $isBlast is never set to true" as mentioned in 0016679:0051745 is incorrect.

look at the function definition. The isBlast defaults to true. Basically, it'll take the blast setting, unless told not to.


23-10-12 16:25

administrator   ~0051767

revision 3362