SMTP email with Mantis 1.2.11
Moderators: Developer, Contributor
SMTP email with Mantis 1.2.11
I am unable to send email from Mantis on a windows server 2008 R2 with firewall turned off.
Below my config_inc.php values. If I telnet the SMTP server I use I get a response and Mantis does not has any error ; i ahev also enabled logs.
$g_phpMailer_method = 'PHPMAILER_METHOD_SMTP'; # or PHPMAILER_METHOD_SMTP, PHPMAILER_METHOD_SENDMAIL, PHPMAILER_METHOD_MAIL
$g_smtp_host = 'mail.authsmtp.com';# used with PHPMAILER_METHOD_SMTP
$g_smtp_username = 'xxxxxxxx';# used with PHPMAILER_METHOD_SMTP
$g_smtp_password = xxxxxxx';# used with PHPMAILER_METHOD_SMTP
$g_smtp_port = 2525;
$g_log_level = LOG_EMAIL | LOG_EMAIL_RECIPIENT | LOG_FILTERING | LOG_AJAX;
can anyone help me; I tried to search the forum and I can see that others had issues in previous versions, but I am unable to get a solution
Thanks
Below my config_inc.php values. If I telnet the SMTP server I use I get a response and Mantis does not has any error ; i ahev also enabled logs.
$g_phpMailer_method = 'PHPMAILER_METHOD_SMTP'; # or PHPMAILER_METHOD_SMTP, PHPMAILER_METHOD_SENDMAIL, PHPMAILER_METHOD_MAIL
$g_smtp_host = 'mail.authsmtp.com';# used with PHPMAILER_METHOD_SMTP
$g_smtp_username = 'xxxxxxxx';# used with PHPMAILER_METHOD_SMTP
$g_smtp_password = xxxxxxx';# used with PHPMAILER_METHOD_SMTP
$g_smtp_port = 2525;
$g_log_level = LOG_EMAIL | LOG_EMAIL_RECIPIENT | LOG_FILTERING | LOG_AJAX;
can anyone help me; I tried to search the forum and I can see that others had issues in previous versions, but I am unable to get a solution
Thanks
Re: SMTP email with Mantis 1.2.11
I am afraid all the solutions posted there did not work for me.atrol wrote:Might help http://www.mantisbt.org/forums/viewtopi ... =3&t=15398
I can telnet from the server the SMTP service so I know I can talk to it. If I try the test_email.php I get a generic error message that does not point me to the problem.
I really need help please
Re: SMTP email with Mantis 1.2.11
I have actually debugged mantis in netbeans PHP IDE and after trying the test_email.php with my config info, this is the error I get
seems like we have a bug guys !!
Code: Select all
phpmailerException object {
message => (string) Could not instantiate mail function.
*Exception*string => (string)
code => (int) 2
file => (string) C:\inetpub\wwwroot\mantisbt\library\phpmailer\class.phpmailer.php
line => (int) 687
*Exception*trace => array(3) (
[0] => array(6) (
[file] => (string) C:\inetpub\wwwroot\mantisbt\library\phpmailer\class.phpmailer.php
[line] => (int) 578
[function] => (string) MailSend
[class] => (string) PHPMailer
[type] => (string) ->
[args] => array(2) (
)
)
[1] => array(6) (
[file] => (string) C:\inetpub\wwwroot\mantisbt\core\email_api.p...
Re: SMTP email with Mantis 1.2.11
another bit of info...
on phpmailer.php, at the code from line 572
although on my config_inc I do have PHPMAILER_METHOD_SMTP for $g_phpMailer_method
the code does not stop at the case SmtpSend but goes to the default and choose MailSend
anybody can figure out why ??
on phpmailer.php, at the code from line 572
Code: Select all
switch($this->Mailer) {
case 'sendmail':
return $this->SendmailSend($header, $body);
case 'smtp':
return $this->SmtpSend($header, $body);
default:
return $this->MailSend($header, $body);
}
the code does not stop at the case SmtpSend but goes to the default and choose MailSend
anybody can figure out why ??
Re: SMTP email with Mantis 1.2.11
and further on...
on the standard.php file the function
is returning false to
and this is causing
to trow the error
hope all this can help someone to help me with this
on the standard.php file the function
Code: Select all
function mail ($to, $subject, $message, $additional_headers = null, $additional_parameters = null) {}
Code: Select all
private function mail_passthru($to, $subject, $body, $header, $params) in phpmailer.php
Code: Select all
protected function MailSend($header, $body)
hope all this can help someone to help me with this
Re: SMTP email with Mantis 1.2.11
if I modify the code of the phpmailer.php to send with SMTP by default, I now get
I am going to change the from to a gmail adrress ??? going crazy here !!
Code: Select all
phpmailerException object {
message => (string) The following From address failed: noreply@bluehorseassociates.com
*Exception*string => (string)
code => (int) 2
file => (string) C:\inetpub\wwwroot\mantisbt\library\phpmailer\class.phpmailer.php
line => (int) 903
*Exception*trace => array(7) (
[0] => array(6) (
[file] => (string) C:\inetpub\wwwroot\mantisbt\library\phpmailer\class.phpmailer.php
[line] => (int) 771
[function] => (string) SmtpSend
[class] => (string) PHPMailer
[type] => (string) ->
[args] => array(2) (
)
)
Re: SMTP email with Mantis 1.2.11
finally I have got the solution !!!
guys you are bad.. really bad...
how can you have a switch statement that is comparing a string to a non string value ???
by simply changing the email_api.php snipped of code from line 904 in the function email_send( $p_email_data ) method
from
to
I finally managed to get emails working fine.
you should add this bit of my post to the http://www.mantisbt.org/forums/viewtopi ... =3&t=15398 post you suggested me to follow.
please reply with your comments on this
Thanks
guys you are bad.. really bad...
how can you have a switch statement that is comparing a string to a non string value ???
by simply changing the email_api.php snipped of code from line 904 in the function email_send( $p_email_data ) method
from
Code: Select all
# Select the method to send mail
switch($config_get('phpMailer_method')) {
case PHPMAILER_METHOD_MAIL:
$mail->IsMail();
break;
case PHPMAILER_METHOD_SENDMAIL:
$mail->IsSendmail();
break;
case PHPMAILER_METHOD_SMTP:
$mail->IsSMTP();
......
Code: Select all
# Select the method to send mail
$MailMethod = config_get('phpMailer_method');
switch($MailMethod) {
case 'PHPMAILER_METHOD_MAIL':
$mail->IsMail();
break;
case 'PHPMAILER_METHOD_SENDMAIL':
$mail->IsSendmail();
break;
case 'PHPMAILER_METHOD_SMTP':
$mail->IsSMTP();
you should add this bit of my post to the http://www.mantisbt.org/forums/viewtopi ... =3&t=15398 post you suggested me to follow.
please reply with your comments on this
Thanks
Re: SMTP email with Mantis 1.2.11
There is no bug in MantisBT.
Your configuration is wrong.
You have to set $g_phpMailer_method the way it's documented
PHPMAILER_METHOD_SMTP is a defined constant, not a string, so you should not use quotes.
Unfortunately I didn't notice the quotes when having a look at your configuration.
Do you agree that you are the bad guy?
Your configuration is wrong.
You have to set $g_phpMailer_method the way it's documented
$g_phpMailer_method
Select the method to mail by: 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.
Code: Select all
$g_phpMailer_method = PHPMAILER_METHOD_SMTP;Unfortunately I didn't notice the quotes when having a look at your configuration.
Do you agree that you are the bad guy?
Re: SMTP email with Mantis 1.2.11
there is a bug in mantis; I tried every single method and it was not working until I made the changes on the code I posted below; I am afraid but is a bug; maybe not on Linux, but definitely in Windows. And then,. why I should use MAILl if I use SMTP ??? in the doc SMTP is supported.. so I think you are a bit wrong
Re: SMTP email with Mantis 1.2.11
Please read exactly what I wrote before:
and not
This is no MantisBT bug.
The bug is in your configuration, you have to setPHPMAILER_METHOD_SMTP is a defined constant, not a string, so you should not use quotes.
Code: Select all
$g_phpMailer_method = PHPMAILER_METHOD_SMTP;Code: Select all
$g_phpMailer_method = 'PHPMAILER_METHOD_SMTP';Re: SMTP email with Mantis 1.2.11
please read exactly what I posted before ; the defined constant does not work ! the string it does; explain to me why
Re: SMTP email with Mantis 1.2.11
my apologies to all of you guys.
I can see it now.. my wrong, totally
atrol is right.
I can see it now.. my wrong, totally
atrol is right.
Re: SMTP email with Mantis 1.2.11
however it does not work 
Re: SMTP email with Mantis 1.2.11
my config now
and the method that I modified before and now reverted
Code: Select all
$g_phpMailer_method = PHPMAILER_METHOD_SMTP; # or PHPMAILER_METHOD_SMTP, PHPMAILER_METHOD_SENDMAIL, PHPMAILER_METHOD_MAIL
$g_smtp_host = 'mail.authsmtp.com';# used with PHPMAILER_METHOD_SMTP
$g_smtp_port = 2525;
$g_smtp_username = 'xxxxxxx';# used with PHPMAILER_METHOD_SMTP
$g_smtp_password = 'xxxxxxx';# used with PHPMAILER_METHOD_SMTP
Code: Select all
# Select the method to send mail
# $MailMethod = config_get('phpMailer_method');
switch(config_get('phpMailer_method')) {
case PHPMAILER_METHOD_MAIL:
$mail->IsMail();
break;
case PHPMAILER_METHOD_SENDMAIL:
$mail->IsSendmail();
break;
case PHPMAILER_METHOD_SMTP:
$mail->IsSMTP();
// SMTP collection is always kept alive
$mail->SMTPKeepAlive = true;
if ( !is_blank( config_get( 'smtp_username' ) ) ) {
# Use SMTP Authentication
$mail->SMTPAuth = true;
$mail->Username = config_get( 'smtp_username' );
$mail->Password = config_get( 'smtp_password' );
}
if ( !is_blank( config_get( 'smtp_connection_mode' ) ) ) {
$mail->SMTPSecure = config_get( 'smtp_connection_mode' );
}
$mail->Port = config_get( 'smtp_port' );
break;
}