View Issue Details

IDProjectCategoryView StatusLast Update
0016679phplist applicationEmailpublic23-10-12 16:25
Reporterduncanc 
PriorityhighSeveritymajorReproducibilityalways
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.

Relationships

has duplicate 0016685 resolvedmichiel Can't add new subscriber 

Activities

michiel

03-09-12 15:42

manager   ~0051717


ah, good one.

raynau

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.

michiel

12-10-12 02:53

manager   ~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.

duncanc

12-10-12 18:40

developer   ~0051743

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

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?

michiel

12-10-12 20:25

manager   ~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.

duncanc

13-10-12 18:58

developer   ~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.

phplistuserx

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..

duncanc

18-10-12 11:20

developer   ~0051755

I have just added a topic to the forum explaining how to work around this problem. See http://forums.phplist.com/viewtopic.php?f=3&t=38374

alpha1

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.

michiel

23-10-12 15:40

manager   ~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

michiel

23-10-12 15:46

manager   ~0051765

sorry, and additionally change line

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

to say

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

michiel

23-10-12 15:50

manager   ~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.

michiel

23-10-12 16:25

developer   ~0051767

revision 3362

Issue History

Date Modified Username Field Change
03-09-12 15:23 duncanc New Issue
03-09-12 15:42 michiel Note Added: 0051717
03-09-12 15:42 michiel Target Version => 2.11.8
21-09-12 15:16 michiel Relationship added has duplicate 0016685
12-10-12 02:03 raynau Note Added: 0051741
12-10-12 02:53 michiel Note Added: 0051742
12-10-12 18:40 duncanc Note Added: 0051743
12-10-12 20:25 michiel Note Added: 0051744
13-10-12 18:58 duncanc Note Added: 0051745
18-10-12 10:50 phplistuserx Note Added: 0051754
18-10-12 11:20 duncanc Note Added: 0051755
22-10-12 21:34 alpha1 Note Added: 0051763
23-10-12 15:40 michiel Note Added: 0051764
23-10-12 15:46 michiel Note Added: 0051765
23-10-12 15:50 michiel Note Added: 0051766
23-10-12 16:25 michiel Note Added: 0051767
23-10-12 16:25 michiel Status new => resolved
23-10-12 16:25 michiel Fixed in Version => 2.11.8
23-10-12 16:25 michiel Resolution open => fixed