配置 MantisBT 使用 GMail 发送电子邮件

发布于 2025-01-06 19:44:12 字数 2788 浏览 1 评论 0原文

我是 Mantis 错误跟踪器的新手,我想在注册新帐户后启用电子邮件通知。

好吧,我在本地计算机上正确安装了 MantisBT,没有任何问题,我已经更改了管理员密码并删除了目录中的 admin 文件夹。之后我注册了一个新帐户,出现一条确认消息,说我需要通过电子邮件验证我的注册。我的问题是没有验证消息发送到我的电子邮件。根据我找到的教程之一,我需要首先配置我的 config_inc.php。安装后,我的config_inc.php的初始内容是

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

所以我将其更改为。 *我在这里使用我的 Gmail 帐户

<?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';
?>

我用这个帐户覆盖我的 config_inc.php,然后注册一个新帐户。提交信息后,出现错误:

致命错误:调用

中未定义的方法 SMTP::getError() myDirectory >\mantis\library\phpmailer\class.phpmailer.php 第 1910 行。

现在我陷入困境,请帮我解决这个问题,我需要设置我的电子邮件通知。我只是创建帐户,但无法使用它们,因为我需要验证它。

如果我需要修改一些相关文件,请告诉我以及步骤是什么。

感谢您的帮助!

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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

回梦 2025-01-13 19:44:12

根据 MantisBT 论坛上的帖子,这些是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;

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;
没︽人懂的悲伤 2025-01-13 19:44:12

关于 GMail 有一些补充。这些设置是正确的,但 GMail 制定了一些新的安全措施,仍然可以防止从 Mantis 或任何其他使用 SMTP 连接器的邮件程序发送电子邮件。

要使用 GMail 执行此操作,您必须“允许安全性较低的应用访问帐户” 。在GMail管理中,有一个设置允许用户控制来自“不太安全的应用程序”的访问,必须打开该设置,然后用于发送邮件的用户帐户必须打开来自“不太安全的应用程序”的访问。上面的链接提供了有关如何配置它的信息。

令人沮丧的是,一切看起来都工作正常,但没有发送任何电子邮件。 SMTP 服务器没有错误指示。但是,用于发送邮件的用户帐户可能会收到来自 GMail 的电子邮件,表明有人正在尝试访问该帐户。我花了几个小时试图找出这一点。

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.

白色秋天 2025-01-13 19:44:12

如果有人在配置时仍然遇到问题或错误,请添加日志级别,以便您可以进一步深入了解问题。以下设置对我有用。详细解释写在这里

$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';

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';
〆凄凉。 2025-01-13 19:44:12
$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;

它对我有用

$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

似梦非梦 2025-01-13 19:44:12

2017 更新 (MantisBT 2.3.0) 请按照以下步骤操作:

[1] 如果您使用 DOCKER

访问运行以下命令的 docker 实例:

docker exec -it {docker-id} bash

[2] INSIDE MANTISBT SERVER

如果您没有)编辑器:

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

创建一个日志文件:

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

[3] EDITING MANTISBT CONFIGURATION

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

将以下内容添加到前面步骤中打开的文件中:

$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

您需要执行以下操作这是为了允许 MantisBT 身份验证:

  1. 访问以下 URL:

    https://myaccount.google.com

  2. 导航至登录页面菜单树下的安全菜单项。

  3. 选中“允许安全性较低的应用程序”选项并将其设置为 true

Image :
在此处输入图像描述]

一切顺利!
使用这些配置进行测试和运行。 =]

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. =]

梦醒灬来后我 2025-01-13 19:44:12

我的问题通过更新 ca 证书得到解决。
我正在 Windows 服务器 2012 上使用 Xampp 和 PHP 7.2。

虽然下面的链接为您提供了详细信息,但我也提到了相关部分:

更新 CA 证书

更新 CA 证书要更新您的 CA 证书,请确保
您的操作系统是完全最新的 - CA 证书通常是
通过操作系统更新进行更新。或者,您可以下载最新的 CA
来自curl的cert文件,将其安装在可访问的地方(例如
/etc/ssl/cacert.pem) 并从 openssl.cafile 中指向它并
php.ini 文件中的curl.cainfo 指令(此位置会有所不同)
根据您的操作系统和 PHP 配置;你需要把它放在哪里
超出了 PHPMailer 的范围!):

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

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

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文