[fixed] $phpmailer_smtpport being ignored

Solutions for other advanced phplisters

[fixed] $phpmailer_smtpport being ignored

Postby arawak » 7:06pm, Wed 12 Sep, 2007

Hi,

I am not able to get PHPlist (2.10.5) to abide by the phpmailer_smtpport directive. It will use different PHPMAILERHOST variables fine and I can confirm that using tcpdump but the phpmailer_smtpport directive seems to be simply ignored -- connections continue to go to 25. My config is below. System is CentOS5 64-bit. php-common-5.1.6-12.el5


# If you tend to send out html emails, it is recommended to do so.
define("PHPMAILER",1);

# To use a SMTP please give your server hostname here, leave it blank to use the standard
# PHP mail() command.
define("PHPMAILERHOST",'10.10.10.10');
$phpmailer_smtpport = '125';


Any suggestions would be greatly appreciated. I have to use a different SMTP port so going to 25 is not an option.
arawak
phpList newbie
 
Posts: 4
Joined: 6:38pm, Wed 12 Sep, 2007

Postby H2B2 » 9:44pm, Wed 12 Sep, 2007

H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006

Postby arawak » 11:07pm, Wed 12 Sep, 2007

Yes I tried implementing that fix as well and it didn't help.
arawak
phpList newbie
 
Posts: 4
Joined: 6:38pm, Wed 12 Sep, 2007

Postby arawak » 3:33am, Thu 13 Sep, 2007

Here is the other thing I don't get.. Why does the smtpport variable only get referenced in the config file? Shouldn't it be referenced elsewhere?

[root@panel lists]# grep -rin smtpport *
config/config.php:623:$phpmailer_smtpport = '125';
[root@panel lists]# pwd
/www/swimclub/phplist/lists


Was smtpport functionality dropped? Or does something outside the install tree reference it?
arawak
phpList newbie
 
Posts: 4
Joined: 6:38pm, Wed 12 Sep, 2007

Postby H2B2 » 9:38pm, Thu 13 Sep, 2007

Haven't looked at the changes in release 2.10.5 yet, but you could take a look of the code for class.phpmailer.php, which in release 2.10.4 looks like this:
Code: Select all
    /////////////////////////////////////////////////
    // SMTP VARIABLES
    /////////////////////////////////////////////////

    /**
     *  Sets the SMTP hosts.  All hosts must be separated by a
     *  semicolon.  You can also specify a different port
     *  for each host by using this format: [hostname:port]
     *  (e.g. "smtp1.example.com:25;smtp2.example.com").
     *  Hosts will be tried in order.
     *  @var string
     */
    var $Host        = "localhost";

    /**
     *  Sets the default SMTP server port.
     *  @var int
     */
    var $Port        = 25;
You might try specifying your host and port in config.php as in the above example, e.g. smtp1.example.com:125, or hardcode the default port
H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006

Postby arawak » 2:31pm, Fri 14 Sep, 2007

By gum that did it!

Think I should open a bug report on this in Mantis? It seems odd that the FAQ would recommend adding the smtpport variable to the config file but then reference it nowhere else.
arawak
phpList newbie
 
Posts: 4
Joined: 6:38pm, Wed 12 Sep, 2007

Postby H2B2 » 2:05pm, Sat 15 Sep, 2007

Yes, I think it would be a good idea to file a report and ask the developers to look at this.

Actually, I recall having added that FAQ -without testing it myself, though- after several forum users indicated they successfully changed the SMTP port that way:
http://forums.phplist.com/viewtopic.php?p=22497#22497
http://forums.phplist.com/viewtopic.php?p=29865#29865
H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006

Postby davidhw » 8:11pm, Tue 04 Dec, 2007

The solution is to add this line in class.phplistmailer.php

after (around line 32)
Code: Select all
      if (isset($GLOBALS['phpmailer_smtpuser']) && $GLOBALS['phpmailer_smtpuser'] != '') {
        $this->SMTPAuth = true;
        $this->Username = $GLOBALS['phpmailer_smtpuser'];
        $this->Password = $GLOBALS['phpmailer_smtppassword'];


add this:

Code: Select all
      $this->Port = $GLOBALS['phpmailer_smtpport'];


That way the port is set by proper class methods, rather than hard-coding the class definition.

Hope that helps someone.
davidhw
phpList newbie
 
Posts: 3
Joined: 8:04pm, Tue 04 Dec, 2007

Postby H2B2 » 8:38pm, Tue 04 Dec, 2007

Thanks David!
I'm sure that will be useful.

Proposed fix added to the corresponding bug tracker report: http://mantis.phplist.com/view.php?id=11493

Cheers!
H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006


Return to Advanced Answers, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 1 guest

cron