phpMailer returns 'invalid address'

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
mymantis42
Posts: 4
Joined: Aug 06, 2015 9:00 am

phpMailer returns 'invalid address'

Post by mymantis42 » Aug 06, 2015 9:18 am

I've read the topic about email notifications, but that's not my case.

Here's are my settings (changed in config_defaults_inc.php, because it doesn't work in default_inc.php) :

Code: Select all

$g_phpMailer_method = PHPMAILER_METHOD_MAIL;
$g_smtp_host = 'zimbra.xxx.fr';
$g_smtp_username = 'username';
$g_smtp_password = 'password';
$g_smtp_connection_mode = 'tls';
$g_smtp_port = 25;
$g_email_send_using_cronjob = OFF;
$g_administrator_email  = 'username@zimbra.xxx.fr';
$g_webmaster_email = 'username@zimbra.xxx.fr';
$g_from_name = 'Mantis Bug Tracker';
$g_return_path_email = 'username@zimbra.xxx.fr';
$g_enable_email_notification = ON;

$g_log_level = LOG_EMAIL | LOG_EMAIL_RECIPIENT;
$g_log_destination = 'file:/tmp/mantisbt.log';

When I try to register a new user on Mantis webpage, or even when I enter the following command :

Code: Select all

php /var/www/mantis/scripts/send_emails.php
Each time, the following error appears (in my log file, or in the console) :

Code: Select all

2015-08-06 16:13 CEST mail Sending message #66 queued on 2015-08-06 15:38 CEST
2015-08-06 16:13 CEST mail ERROR: Message could not be sent - Invalid address: 1
I don't understand what's happened, I don't have any email parameter with '1' ..
I've read some things about the phpMailer, but I don't really understantd.
Is it a known error ?

Thank you

atrol
Site Admin
Posts: 7652
Joined: Mar 26, 2008 4:37 pm
Location: Germany

Re: phpMailer returns 'invalid address'

Post by atrol » Aug 06, 2015 9:53 am

mymantis42 wrote: Here's are my settings (changed in config_defaults_inc.php, because it doesn't work in default_inc.php) :
It seems it does also not work in config_defaults_inc.php ;-) Never ever change this file. There is no need for it. You might get problems when upgrading to a newer version.
mymantis42 wrote:

Code: Select all

$g_phpMailer_method = PHPMAILER_METHOD_MAIL;
$g_smtp_host = 'zimbra.xxx.fr';
$g_smtp_username = 'username';
$g_smtp_password = 'password';
$g_smtp_connection_mode = 'tls';
$g_smtp_port = 25;
As long as you set

Code: Select all

$g_phpMailer_method = PHPMAILER_METHOD_MAIL;
None of your SMTP settings will be used

Code: Select all

$g_smtp_host = 'zimbra.xxx.fr';
$g_smtp_username = 'username';
$g_smtp_password = 'password';
$g_smtp_connection_mode = 'tls';
$g_smtp_port = 25;
From https://www.mantisbt.org/docs/master-1. ... NFIG.EMAIL
$g_phpmailer_method
Select the method to send mail:

PHPMAILER_METHOD_MAIL for use of mail() function,
PHPMAILER_METHOD_SENDMAIL for sendmail (or postfix),
PHPMAILER_METHOD_SMTP for SMTP,

Default is PHPMAILER_METHOD_MAIL.
Please use Search before posting and read the Manual

mymantis42
Posts: 4
Joined: Aug 06, 2015 9:00 am

Re: phpMailer returns 'invalid address'

Post by mymantis42 » Aug 06, 2015 10:10 am

Yes, sorry it's "config_inc.php" which doesn't work with my settings (except for databases and connection settings, I think because Mantis has write in this file.. ).

And like I didn't know which parameter I need, I tried even with this too :

Code: Select all

$g_phpMailer_method = PHPMAILER_METHOD_SMTP;
But I've the same error..
And even if my $g_smtp_host value is empty, the same error..

It could be a PhpMailer bug, but I don't find my error here : https://github.com/PHPMailer/PHPMailer/issues

atrol
Site Admin
Posts: 7652
Joined: Mar 26, 2008 4:37 pm
Location: Germany

Re: phpMailer returns 'invalid address'

Post by atrol » Aug 06, 2015 5:11 pm

Which version of MantisBT do you use?
Please use Search before posting and read the Manual

mymantis42
Posts: 4
Joined: Aug 06, 2015 9:00 am

Re: phpMailer returns 'invalid address'

Post by mymantis42 » Aug 07, 2015 2:23 am

Mantis version : MantisBT 1.2.19.
OS : Debian Wheezy (7.8).

atrol
Site Admin
Posts: 7652
Joined: Mar 26, 2008 4:37 pm
Location: Germany

Re: phpMailer returns 'invalid address'

Post by atrol » Aug 07, 2015 4:09 am

Is this a fresh installation or an upgrade from earlier version?

Can I be 100% sure that you use the original config_defaults_inc.php that comes with MantisBT 1.2.19?
Did you change any other file from the original download?

Does it work or produce another error than before if you add the following line to config_inc.php?

Code: Select all

$g_validate_email		= OFF;
Please use Search before posting and read the Manual

mymantis42
Posts: 4
Joined: Aug 06, 2015 9:00 am

Re: phpMailer returns 'invalid address'

Post by mymantis42 » Aug 07, 2015 5:43 am

I'm very sorry, it was the 1.2.15 ....
With the 1.2.19, yes, the file "config_inc.php" works well :)


And the new SMTP error in my logs :

Code: Select all

2015-08-07 12:37 CEST mail Signup Email = me@zimbra.xxx.fr, Hash = 3a53b6a39af29381f4b431ff05e7335f, User = @U39
2015-08-07 12:37 CEST mail Processing e-mail queue (1 messages)
2015-08-07 12:37 CEST mail Sending message #77 queued on 2015-08-07 12:37 CEST
2015-08-07 12:37 CEST mail ERROR: Message could not be sent - SMTP Error: Could not connect to SMTP host.
2015-08-07 12:37 CEST mail message #78 queued
2015-08-07 12:37 CEST mail New Account Notify for email = 'me@zimbra.xxx.fr
2015-08-07 12:37 CEST mail Processing e-mail queue (2 messages)
2015-08-07 12:37 CEST mail Sending message #77 queued on 2015-08-07 12:37 CEST
2015-08-07 12:37 CEST mail ERROR: Message could not be sent - SMTP Error: Could not connect to SMTP host.
2015-08-07 12:37 CEST mail Sending message #78 queued on 2015-08-07 12:37 CEST
2015-08-07 12:37 CEST mail ERROR: Message could not be sent - SMTP Error: Could not connect to SMTP host.

And when I try to use

Code: Select all

$g_phpMailer_method = PHPMAILER_METHOD_MAIL;

Code: Select all

2015-08-07 12:30 CEST mail New Account Notify for email = 'me@zimbra.xxx.fr'
2015-08-07 12:30 CEST mail Processing e-mail queue (1 messages)
2015-08-07 12:30 CEST mail Sending message #76 queued on 2015-08-07 12:30 CEST
2015-08-07 12:30 CEST mail message #76 deleted from queue
But I never received any emails..
I can launch

Code: Select all

telnet zimbra.xxx.fr 25
without problems..


EDIT : It was some errors about ssl/tls and username format specific to Zimbra.
It works very well now :)

Last question : is it possible to have multiple SMTP configurations (to send mails to multiple SMTP servers)... ?

Thanks for your help ;)

atrol
Site Admin
Posts: 7652
Joined: Mar 26, 2008 4:37 pm
Location: Germany

Re: phpMailer returns 'invalid address'

Post by atrol » Aug 10, 2015 4:22 pm

mymantis42 wrote:is it possible to have multiple SMTP configurations (to send mails to multiple SMTP servers)... ?
It's not possible out of the box.
Please use Search before posting and read the Manual

Post Reply