Configuring MantisBT to send emails using GMail
Asked Answered
S

6

17

I am new to Mantis bug tracker and I want to enable the email notification after registering for a new account.

Well, I installed the MantisBT correctly without any problem on my local computer, I already changed the admin's password and removed the admin folder in the directory. After this I signed up for a new account, there was a confirmation message flashed saying that I need to verify my registration via email. My problem here is that no verification message was sent to my email. According to one of the tutorials I found, I need to configure first my config_inc.php. After the installation, the initial content of my config_inc.php was

<?php
$g_hostname      = 'localhost';
$g_db_username   = '<myUser>';
$g_db_password   = '<myPass>';
$g_database_name = 'bugtracker';
$g_db_type       = 'mysql';
?>

So I changed it to. *I am using my gmail account here

<?php
$g_hostname      = 'localhost';
$g_db_username   = '<myUser>';
$g_db_password   = '<myPass>';
$g_database_name = 'bugtracker';
$g_db_type       = 'mysql';

$g_allow_signup             = ON;
$g_allow_anonymous_login    = OFF;
$g_anonymous_account        = '';

$g_phpMailer_method     = PHPMAILER_METHOD_SMTP; 
$g_smtp_host            = 'smtp.gmail.com';
$g_smtp_username        = '<[email protected]>';
$g_smtp_password        = '<myPass>';
$g_administrator_email  = '<[email protected]>';
$g_webmaster_email      = '<[email protected]>';
$g_from_name            = 'Mantis Bug Tracker';
$g_from_email           = '<[email protected]>';
$g_return_path_email    = '<[email protected]>';
$g_email_receive_own    = OFF;
$g_email_send_using_cronjob = OFF;

$g_allow_file_upload    = ON;
$g_file_upload_method   = DATABASE;
$g_absolute_path_default_upload_folder = '';
$g_max_file_size        = 5000000;
$g_preview_attachments_inline_max_size = 256 * 1024;
$g_allowed_files        = '';
$g_disallowed_files     = '';

$g_window_title         = 'MantisBT';
$g_logo_image           = 'images/mantis_logo.gif';
$g_favicon_image        = 'images/favicon.ico';

$g_show_realname = OFF;
$g_show_user_realname_threshold = NOBODY;

$g_default_home_page = 'my_view_page.php';
?>

I overwrite my config_inc.php with this one and then register for a new account. After submitting the information, an error occured saying:

Fatal error: Call to undefined method SMTP::getError() in < myDirectory >\mantis\library\phpmailer\class.phpmailer.php on line 1910.

And now I'm stucked, please help me with this, I need to setup my email notification. I was just creating accounts but I cannot use them because I need to verify it.

Please let me know if I need to modify some of the related files and what are the steps.

Thanks for the help!

Sphericity answered 20/2, 2012 at 6:12 Comment(2)
What version of Mantis are you using?Ectoblast
I think you should report a bug at mantisbt.org/bugs/bug_report_page.phpEctoblast
E
32

According to a posting on the MantisBT forums, these are working settings for GMail:

$g_phpMailer_method = PHPMAILER_METHOD_SMTP;
$g_smtp_host = 'smtp.gmail.com';
$g_smtp_username = '[email protected]';
$g_smtp_password = 'yourpassword';
$g_smtp_connection_mode = 'ssl';
$g_smtp_port = 465;
Ectoblast answered 2/3, 2012 at 10:20 Comment(2)
Thanks for this! This one works for me, but I removed the ":465" in smtp_host but it works! I don't know if there is bug, but I think already tried this one (or maybe there was a little difference). Anyway, thanks for this!Sphericity
I used WAMP, which need extra steps as pointed out by mantis forum post (fluffy.mantisbt.org/forums/viewtopic.php?f=3&t=15398): - If you are using WAMP server then make sure you have enabled the Apache >>Apache modules>>ssl_module AND PHP>>Php extensions>>php_opensslRincon
B
3

Something to add about GMail. These settings are correct but GMail has instituted some new security that will still prevent email from being sent from Mantis or any other mailer using the SMTP connector.

In order to do this with GMail, you must "Allow less secure apps to access accounts". In GMail admin, there is a setting to allow users to control access from "less secure apps," which must be turned on, and then the user account used to send mail must turn on access from "less secure apps." The link above provides the information on how to configure this.

The frustrating thing is everything will appear to work fine but no emails are sent. There is no error indication from the SMTP server. However, the user account used to send mail may receive an email from GMail indicating someone is trying to access the account. I spent hours trying to track this down.

Blowfish answered 19/4, 2016 at 18:57 Comment(0)
C
3

If anyone still faces issue or error while configuration add log level so that you can drill down the problem further. Below settings worked for me. Detailed explanation is written here

$g_phpMailer_method = PHPMAILER_METHOD_SMTP;
$g_smtp_host = 'smtp.gmail.com';
$g_smtp_port = '465';
$g_smtp_connection_mode = 'ssl';
$g_smtp_username = '[email protected]';
$g_smtp_password = 'xxxxx';
$g_administrator_email = '[email protected]';
$g_webmaster_email = '[email protected]';
$g_from_email = '[email protected]';
$g_return_path_email = '[email protected]';
$g_default_timezone = 'UTC';
$g_log_level = LOG_EMAIL | LOG_EMAIL_RECIPIENT;
$g_log_destination = 'file:C:\mantisbt.log';
Contemplative answered 8/2, 2017 at 21:15 Comment(1)
Warning: replace 'smart' apostrophes with plain apostrophes.Unusual
B
2
$g_phpMailer_method = PHPMAILER_METHOD_SMTP;
$g_smtp_host = 'smtp.gmail.com';
$g_smtp_username        = 'username';   // without @gmail.com
$g_smtp_password        = 'password';
$g_smtp_connection_mode = 'ssl';
$g_smtp_port = 465;

it Works for me

Blackguard answered 3/4, 2016 at 5:22 Comment(0)
M
2

2017 update (MantisBT 2.3.0) Please follow the steps below:

[1] IF YOU'RE USING DOCKER

Access the docker instance running the command below:

docker exec -it {docker-id} bash

[2] INSIDE MANTISBT SERVER

if you dont have any editor:

# sudo apt-get update
# apt-get install vim

create a log file:

# touch /var/log/mantisbt.log
# cd /var/log/
# chmod 777 mantisbt.log

[3] EDITING MANTISBT CONFIGURATION

# vim /var/www/html/config/config_inc.php

add the following content to the file opened in the earlier step:

$g_phpMailer_method = PHPMAILER_METHOD_SMTP;
$g_administrator_email = '[email protected]';
$g_webmaster_email = '[email protected]';
$g_return_path_email = '[email protected]';
$g_from_email = '[email protected]';

$g_smtp_host = 'smtp.gmail.com';
$g_smtp_port = 465;
$g_smtp_connection_mode = 'ssl';
$g_smtp_username = 'username';
$g_smtp_password = 'password';

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

$g_validate_email = OFF;

[4] EDITING GMAIL CONFIGURATION

You need to do this in order to allow MantisBT authentication:

  1. Access the following URL:

    https://myaccount.google.com

  2. Navigate to the Sign-in & Security menu-item under menu-tree.

  3. Check the "Allow less secure apps" option and set equals to true

Image: enter image description here]

You're good to go! Tested and running with these configurations. =]

Masry answered 8/4, 2017 at 18:7 Comment(1)
what about smtp ? in my docker image it's missingIodous
R
0

My issue was solved by updating ca certificates. I am using Xampp, with PHP 7.2 on Windows sever 2012.

Although the below link provides you with the details, I mention the relavent part too:

Updating CA certificates

Updating CA certificates To update your CA certificates, make sure your operating system is fully up to date - CA certs are usually updated via OS updates. Alternatively, you can download the latest CA cert file from curl, install it somewhere accessible (for example /etc/ssl/cacert.pem) and point at it from the openssl.cafile and curl.cainfo directives in your php.ini file (this location will vary according to your OS and PHP config; where you need to put it is beyond the scope of PHPMailer!):

openssl.cafile = /etc/ssl/cacert.pem 
curl.cainfo = /etc/ssl/cacert.pem

https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting#updating-ca-certificates

Runty answered 3/5, 2018 at 11:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.