Email Setup Problems - Ver 2.23

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
peter_ia
Posts: 4
Joined: 08 Feb 2020, 16:21

Email Setup Problems - Ver 2.23

Post by peter_ia »

Hello,
I'm new to Mantis and PHP and I've gotten pretty far with email setup but it's still not working.
I am able to send email directly through a sendmail() test program (shown below) using the same credentials
I'm also able to send via c# using the .net smtp library so I'm pretty sure my gmail security is working properly.
I'm aware what I posted says _SMTP but I've also tried _SENDMAIL. Neither work for me.
Mantis itself runs fine, it's now just the email configuration. that's got me stumped.
I have read all the posts, including the one that is 10 year's old on using Mantis with gmail. Maybe it's still current but I'm not certain.

Thanks in advance for your help,

Peter 8O

MantisBT 2.23.0
PHP 7.4.2
MySQLi 10.4.11

SendMail.ini

Code: Select all

[sendmail]
smtp_server=smtp.gmail.com
smtp_port=587
smtp_ssl=tls
error_logfile=error.log
debug_logfile=debug.log
auth_username=myname@gmail.com
auth_password=xxxxxxxxxxxxxxxx
force_sender=myname@gmail.com
php.ini

Code: Select all

[mail function]
SMTP=smtp.gmail.com
smtp_port=587
smtp_ssl=tls
auth_username=myname@gmail.com
auth_password=xxxxxxxxxxxxxxxx
sendmail_from = myname@gmail.com
sendmail_path = C:\xampp\sendmail
config_inc.php

Code: Select all

$g_allow_signup	 = OFF;  //allows the users to sign up for a new account
$g_enable_email_notification = ON; //enables the email messages
$g_phpMailer_method = PHPMAILER_METHOD_SMTP;
$g_smtp_host = 'smtp.gmail.com';
$g_smtp_connection_mode = 'tls';
$g_smtp_port = 587;
$g_smtp_username = 'myname@gmail.com'; //replace it with your gmail address
$g_smtp_password = 'xxxxxxxxxxxxxxxxxx"; //replace it with your gmail password
$g_return_path_email = 'myname@gmail.com'; //this will be your administrator email address
$g_administrator_email = 'myname@gmail.com'; //this will be your administrator email address
$g_webmaster_email = 'myname@gmail.com'; //this will be your administrator email address
$g_email_send_using_cronjob = OFF;
$g_email_receive_own = ON;
$g_debug_email = ON;
$g_from_email = 'myname@gmail.com'; //this will be your administrator email address
$g_from_name = 'IA Bugtracker';
$g_log_level = LOG_EMAIL | LOG_EMAIL_VERBOSE;
$g_log_destination = 'file:c:\temp\mantisEmail.log';
$g_validate_email = ON;
ErrorLog from Mantis

Code: Select all

2020-02-08 11:36 EST MAIL_VERBOSE email_queue_api.php:127 email_queue_add() message 17 queued
2020-02-08 11:36 EST MAIL email_api.php:576 email_send_confirm_hash_url() Password reset for user @U4 sent to pnirenberg.ids@gmail.com
2020-02-08 11:36 EST MAIL_VERBOSE email_api.php:2092 email_shutdown_function() Shutdown function called for /mantis/manage_user_reset.php (email processing forced)
2020-02-08 11:36 EST MAIL_VERBOSE email_api.php:1208 email_send_all() Processing e-mail queue (2 messages)
2020-02-08 11:36 EST MAIL_VERBOSE email_api.php:1219 email_send_all() Sending message 16
2020-02-08 11:36 EST MAIL_VERBOSE email_api.php:1354 email_send() Using debug email '1'
2020-02-08 11:36 EST MAIL email_api.php:1361 email_send() ERROR: Message could not be sent - Invalid address:  (to): 1
2020-02-08 11:36 EST MAIL_VERBOSE email_api.php:1219 email_send_all() Sending message 17
2020-02-08 11:36 EST MAIL_VERBOSE email_api.php:1354 email_send() Using debug email '1'
2020-02-08 11:36 EST MAIL email_api.php:1361 email_send() ERROR: Message could not be sent - Invalid address:  (to): 1
Test Email Program

Code: Select all

<?php 
$to_email = 'myname@gmail.com';
$subject = 'Testing PHP Mail';
$message = 'This mail is sent using the PHP mail function';
$headers = 'From: myname@gmail.com';
mail($to_email,$subject,$message,$headers);
?>
kukaber
Posts: 6
Joined: 26 Dec 2017, 19:42

Re: Email Setup Problems - Ver 2.23

Post by kukaber »

"$g_debug_email = ON" in your config_inc.php is wrong.
use $g_debug_email = 'xyz@mail.tld'

http://www.mantisbt.org/docs/master/en- ... ig.logging
peter_ia
Posts: 4
Joined: 08 Feb 2020, 16:21

Re: Email Setup Problems - Ver 2.23

Post by peter_ia »

Thank-you for the reply but this caused the following problems.

1. When I clicked Password reset for a user (me) I received "Undefined variable $t_reset in manage_user_reset.php
After looking at the code I defned it as True;

2. This caused $t_result to be undefined so I also set that to $t_result=True;

3. Restarted Apache and tried with SENDMAL. Here is the error from my log file:
2020-02-11 05:54 EST MAIL_VERBOSE email_api.php:1354 email_send() Using debug email 'xxxxx@gmail.com'
2020-02-11 05:54 EST MAIL email_api.php:1409 email_send() ERROR: Message could not be sent - Could not execute: C:\xampp\sendmail

4. I also tried with SMTP and got the same results.

It feels like I'm getting closer but it's hard to tell.
kukaber
Posts: 6
Joined: 26 Dec 2017, 19:42

Re: Email Setup Problems - Ver 2.23

Post by kukaber »

Hello Peter,
if you create several topics for the same problem, then it would be nice if you would also write in all topics that the problem is solved.
Post Reply