[Walktrough] Five steps to get phplist running

Solutions for other phpList version 2 users
Forum rules
Please do not ask questions here, this is for Solutions you have discovered or come across.

[Walktrough] Five steps to get phplist running

Postby Peter Stadie » 3:33pm, Fri 21 Sep, 2007

PROBLEMS WALK THROUGH
1. Code Spew
2. Configuration problems
3. connection error
4. Firewall configuration
5. check your “From line”
6. add the black list table to your DB

1. Code Spew
Or name it “Some unprocessed PHP”, “garbage” etc.
This is a short version of the post:
http://forums.phplist.com/viewtopic.php?p=36664#36664

reason: there are different ways of starting php code. Today’s standard is '<?php' but some servers allow old forms like '<?' etc.

The solution is to search all files in the phplist installation for <? and replace them with <?php.

FIRST BACKUP YOUR PHPLIST DIRECTORY!!!!!!!!!!!!!!!!!!

Use Dreamweaver for the first one use regular expressions:
Search: <\?(?=\s)
Replace: <?php

(10 items replaced)

There are several files that also have <?= ?> tags that will cause a problem as well.
Use Dreamweavers search & replace but NO REGEX.

Search: <?=
Replace: <?php echo
!!!! AGAIN, CAREFULL NO REGEX!!!
(7 items replaced)

Don't forget to put a trailing space after echo or it won't work properly.

Something went wrong? You used regex for the second replace? You don't have a backup?
I am truly sorry! Check out the original thread there might be a cure.

2. configuration:
Problem: Message sending failed.

Open config/config.php

define ("TEST",0); Default is on 1!!!

and much further down ?!?
define("PHPMAILERHOST",'mail.yourdomain.com');
$phpmailer_smtpuser = 'user';
$phpmailer_smtppassword = 'pwd';

3. connection error
In eventlog: Mailer Error: SMTP Error: Could not connect to SMTP host.

It was a firewall problem AND another problem which made me believe I do not have a firewall problem. Well, this is what happens, if you turn your firewall of and the problem doesn't disappear. You think it's not the firewall and turn it on again.
Than you try to fix a problem you actually don't have...

My second mistake was that I had the same email address in the "From line" as in the "Send test to" field. It is clearly said, that you must not send a test mail to an address not in the list, but I could not find a hint, that both above fields must not be the same as well...

OK, here is a faster way for you to check what problem your installation might have and how to fix it.

Here are the steps for testing it.
First, make sure it's nothing inside phplist and the problem can be reduced to the connection.
I wrote a script to talk directly over phpmailer without phplist in between. Put this file into the admin/phpmailer/ directory and called e.g. test.php. Navigate to it directly over your browser e.g. http://localhost/phplist/admin/phpmailer/test.php.

If you see an error, it is merely a connection problem. If not, the problem is somewhere else.
Code: Select all
 <php>CharSet = "utf-8";
$mail->IsSMTP();
$mail->Host     = $mail_host;
$mail->Username = $mail_username;
$mail->Password = $mail_password;
$mail->SMTPAuth = true;
$mail->From     = "you1@yourdomain.com";
$mail->FromName = "Test - your name";
$mail->AddAddress("you2@yourdomain2.com","Service");
$mail->Subject  =  "Testmail";
$mail->IsHTML(true);
$mail->Body = "<html><head><title>test</title><head><body><b>testmail</b></body></html>";
$mail->AltBody  = "alternativ als text";

if( ! $mail->Send())
{
   echo "Problem: ";
   echo $mail->ErrorInfo;
}else{
   echo "gesendet";
}

?>


It's a connection problem, what now?

Check your firewall settings. First just disable the firewall and test it again. If it goes through, it's a firewall problem, see step 3. If it does not go through (even the firewall is down) than it is a problem with your connection. Can you send email over you standard email client? Are server and username, password etc the same? Check these basics things.

4. OK, It's the firewall

You have to permit two forms of communication, inbound and outbound.
At your side the server (e.g. Apache.exe) needs to establish an outbound connection (Port 53 UDP).
The the remote SMTP server needs to talk back on Port 25.
Check if both forms of connection are allowed. I am very careful with my web server. So I permit single ports on for single addresses.
However, better check out if the SMTP server talks back from a different address. For checking you can see the logs. It's not always the same name (or IP). E.g. I connected via Apache port 53 with mail.domain_1.com and the SMTP Server talked back from mail.domain_2.com on port 25.
ALL THESE ports and addresses need to be permitted to allow this communication.

I am using Norton Internet Security and the log viewer (Firewall log) is very handy. Use it together with the option "monitor". You can do this by manually create rules for Apache.exe. Put on top of it a monitor rule which allows almost everything. This way you can find out what's going on.

5. check your “From line”
AGAIN: DO NOT use the same address for "from" and for "send test message to ...".
In fact, do not use an address which appears anywhere else in the mail list for

check this too
Don’t forget to have a look at admin/defaultconfig.inc!
There are constant email addresses like the following and other setups.
listreports@[DOMAIN]
noreply@[DOMAIN]

6. In version 2.10.5 the table phplist_user_blacklist_data doesn't exist
read more:
http://forums.phplist.com/viewtopic.php?p=33737#33737
However, be careful with the first line, this is all about a not existing table, what makes no sense to drop. If you have the table already, make sure you don't drop your valuable black list!

AND, I am using the engine InnoDB with utf8, you might want to change this as well.
Here the statement which works for me:

DROP TABLE IF EXISTS `YOUR DBNAME`.`phplist_user_blacklist_data`;
CREATE TABLE `YOUR DBNAME`.`phplist_user_blacklist_data` (
`email` varchar(255) NOT NULL default '',
`name` varchar(100) default NULL,
`data` text,
UNIQUE KEY `email` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

[/b]
Peter Stadie
phpList newbie
 
Posts: 2
Joined: 3:03pm, Fri 21 Sep, 2007

Postby Ernesto » 2:47am, Tue 08 Apr, 2008

Very useful addition to the FAQ and Troubleshooting documentation.

Thx!
Search first, Ask questions later...
Ernesto
PL Freak!
 
Posts: 592
Joined: 2:25am, Thu 08 Jun, 2006

Postby Dragonrider » 12:40pm, Thu 27 Nov, 2008

If you haven't got Dreamweaver, you can also use a text editor such as Notepad, though I personally prefer Editpad.
My sites:- http://wharfedalefestival.co.uk, http://ilkleygardeners.org.uk, http://emergencyaid.net, http://dragonrider.co.uk
Latest phpList version is now 3.0.12 (3 February 2015) and requires a minimum of MySQL 5.0 and PHP 5.3.x
Dragonrider
Moderator
 
Posts: 3460
Joined: 6:58am, Sun 02 Jul, 2006
Location: Ilkley, West Yorkshire, United Kingdom

Re: [Walktrough] Five steps to get phplist running

Postby oromoiluig » 6:04pm, Sun 21 Feb, 2010

I used to get the "SMTP Error: Could not connect to SMTP host" error.

The problem was with the port used: my smtp server needed port 587 , while the default used was 25.
I couldn't manage to find wether there was a place where to set it, so I went my own way:
in the config.php file I added the following line:

define("SMTP_PORT",'587'); //default: 25

Here you can set the port to be used by the smtp connection.

then in the sendemaillib.php on line 603 (just after $mail = new PHPlistMailer($messageid,$destinationemail); )
I added the following line:

$mail->Port = SMTP_PORT;
oromoiluig
phpList newbie
 
Posts: 1
Joined: 5:57pm, Sun 21 Feb, 2010

Re: [Walktrough] Five steps to get phplist running

Postby RTWolf » 3:06pm, Sat 03 Apr, 2010

If you haven't got Dreamweaver, you can use the free Notepad++. It allows you to do a search and replace on a directory so you don't have to manually open a file, replace everything, open the next one, etc.
RTWolf
PL Nut
 
Posts: 24
Joined: 2:42pm, Wed 31 Mar, 2010

Re: [Walktrough] Five steps to get phplist running

Postby Acelock » 9:26pm, Tue 11 May, 2010

As RTWolf said, Notepad++ is a great free tool for editting html and css
Acelock
phpList newbie
 
Posts: 1
Joined: 9:15pm, Tue 11 May, 2010


Return to Answers, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 2 guests

cron