SMTP

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
danieljanzon
Posts: 4
Joined: 28 May 2007, 14:19

SMTP

Post by danieljanzon »

A while ago I installed Mantis 1.0.6 on Ubuntu Feisty Fawn. But SMTP emailing still doesn't work properly. I fire up admin/check.php and do the email test. I get this:

Code: Select all

Testing Mail -

SYSTEM WARNING: PHPMailer::include_once(PHPMAILER_PATHclass.smtp.php) [function.PHPMailer-include-once]: failed to open stream: No such file or directory

SYSTEM WARNING: PHPMailer::include_once() [function.include]: Failed opening 'PHPMAILER_PATHclass.smtp.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear')

Fatal error: Class 'SMTP' not found in /usr/share/php/libphp-phpmailer/class.phpmailer.php on line 527

Is this a pure PHP problem totally outside the Mantis realm? Anyone know the next step in getting this to work?

/ Daniel
deboutv
Posts: 507
Joined: 15 Jan 2007, 14:31
Location: La Ciotat, FRANCE
Contact:

Post by deboutv »

Yes there is an error in the PHP code. It is propabably at the beginning ot the core/email_api.php file.

You must have something like this:
define( 'PHPMAILER_PATH', $t_core_dir . 'phpmailer' . DIRECTORY_SEPARATOR );
Want more plugins to customize Mantis?
=> http://deboutv.free.fr/mantis/

Mantis: 1.1.0, 1.1.0a2
PHP: 5.0.4
SQL: MySQL 5.0.19
OS: Linux
danieljanzon
Posts: 4
Joined: 28 May 2007, 14:19

Post by danieljanzon »

I had this line in email_api.php

# reusable object of class SMTP
$g_phpMailer_smtp = null;


I outcommented it. And then I had no phpmailer directory in /usr/share/mantis/www/core. But I had installed the phpmailer package. So I added a symbolic link so /usr/share/mantis/www/core/phpmailer pointed to /usr/share/php/libphp-phpmailer. Voila -- it worked.
CapFi
Posts: 5
Joined: 10 Dec 2007, 10:25

Re: SMTP

Post by CapFi »

Daniel


I've got exactly the same error,

and I've posted today about it,

I'm a beginner, is it possible for you to explaine step by step ?

En fait je suis plutôt vers le niveau ZERO en PHP et autre. (my knowlegde in PHP is nearly the absolute 0). :(

Thank's
trantako
Posts: 2
Joined: 24 Jun 2008, 07:14

Re: SMTP

Post by trantako »

I just installed mantis to Ubuntu 8.04. In order to get it working with vanilla 8.04 desktop, I had to first install LAMP as follows:

Code: Select all

sudo tasksel install lamp-server
The password to be set for MySQL administration account was requested during LAMP installation. Note that it needs to be set before proceeding to mantis installation, as it is needed by mantis installation script. Now, I was ready to install mantis:

Code: Select all

sudo apt-get install mantis
After installation finished, I opened a web browser and went to http://127.0.0.1/mantis and logged in as "administrator" and "root". I tried to creat a new user for administration, as suggested by mantis installation script. However, mail feature did not work, and thus I could not receive the password required for logging in with the newly created user account. :?

Then I found out that I can check mantis configuration with web browser at http://127.0.0.1/mantis/admin/check.php. However, in order to get pass "Permission denied" message when accessing this page, I had to temporarily change /etc/mantis/apache.conf: in the end of the file, I changed the line saying "deny from all" temporarily to "allow from all". Now I could access check.php and test mail function from there.

The error message I received was "Language string failed to load: instantiate". I was confused for awhile, but then learned that this is related to phpmail, and that there seems to be multiple methods in sending mail with phpmail. The default one probably did not work, because the vanilla 8.04 desktop did not have any mail sending features installed. However, one of the other options (method number 2) was to use an external SMTP server. As this is what I preferred to do, I modified /usr/share/mantis/www/config_local.php by adding a few new configuration lines:

Code: Select all

$g_phpMailer_method = 2;
$g_smtp_host = 'YOUR_SMTP_SERVER';
$g_stop_on_errors = ON;
$g_email_receive_own = ON;
Now, the error message changed to the one described in this discussion thread (and that's how I find my way here). The problem seems to be related to PHPMAILER_PATH, which is used in the code but not defined anywhere (at least I could not find it). In order to fix it, I edited /usr/share/mantis/www/core/email_api.php by adding a new line after line 19:

Code: Select all

define( 'PHPMAILER_PATH', 'libphp-phpmailer' . DIRECTORY_SEPARATOR );
After this I tested mail again with check.php, and it worked! No error messages, and the mail dropped to my mail box after a moment. :D

This should probable be fixed in mantis source code.
trantako
Posts: 2
Joined: 24 Jun 2008, 07:14

Re: SMTP

Post by trantako »

Note: do not put

Code: Select all

$g_stop_on_errors = ON;
to production machines - in case of an error, you'll get a blank page.
Edward
Posts: 1
Joined: 12 Sep 2008, 12:21

Re: SMTP

Post by Edward »

Just wanted to say a big thank you to trantako for sharing a solution that works.

QUOTE...

The problem seems to be related to PHPMAILER_PATH, which is used in the code but not defined anywhere (at least I could not find it). In order to fix it, I edited /usr/share/mantis/www/core/email_api.php by adding a new line after line 19:

define( 'PHPMAILER_PATH', 'libphp-phpmailer' . DIRECTORY_SEPARATOR );

After this I tested mail again with check.php, and it worked! No error messages, and the mail dropped to my mail box after a moment.

...UNQUOTE


Thanks again
Ed.
abrange
Posts: 1
Joined: 24 Jan 2009, 21:01

Re: SMTP

Post by abrange »

Hi,
thank for you step by step. I made the same like you but I added

Code: Select all

define( 'PHPMAILER_PATH', 'libphp-phpmailer' . DIRECTORY_SEPARATOR );
into class.phpmailer.php file in line 20 like is show below and it works too :)

Code: Select all

/**
 * PHPMailer - PHP email transport class
 * @package PHPMailer
 * @author Brent R. Matzelle
 * @copyright 2001 - 2003 Brent R. Matzelle
 */
define( 'PHPMAILER_PATH', 'libphp-phpmailer' . DIRECTORY_SEPARATOR );
Thanks to all
Post Reply