Page 1 of 7

Please read this if you have problems with emails

Posted: 02 Dec 2010, 16:38
by istvanb
Mantis Email settings

Configuring the email settings is challenging task for most of the users start working with Mantis. The confusion is partially caused because PHP (so therefore Mantis) does not give you a very precise description about why it can not deliver emails.

The goal of this topic is to show you how to configure your mantis to work with gmail (so register a gmail account if you dont have one). Once you made it work with gmail you can make sure your system is capable to deliver the emails, so then you can apply your own settings (you may want to use yahoo mail, or your company enviroment)


Most of the cases the configuration is very easy:

1, open your config_inc.php (located in: <XAMPP>\htdocs\mantis\ or <WAMP>\www\mantis\ )
2, copy the following code to the file:

Code: Select all

$g_allow_signup	 = ON;  //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 = 'youraccount@gmail.com'; //replace it with your gmail address
$g_smtp_password = '*********'; //replace it with your gmail password
$g_administrator_email = 'youradmin@whatever.com'; //this will be your administrator email address
3, go to your Mantis homepage (http://localhost/mantis)
4, click sign up for a new account
5, create a dummy account with your gmail address
6, press Signup
7, check your mail

If everything is alright then you have received an email which proves that your system is installed properly and capable to send emails. From this point it is your task to figure out the smtp settings of the system you want to use. (so the settings are different for lets say the yahoo mail)


What to do if you still dont receive emails?

- Check if you use right gmail account and password
- If you are about to use gmail then you may have to authenticate mantis to access to your account. You can do this in you gmail account by going to your account -> security -> scroll down to Connected applications and sites and click manage access. If you are using this security feature of gmail then you have to use the generated password in your config_inc.php
- If you are using XAMPP then make sure you have enabled the openssl service by checking your /xampp/php/php.ini for the following line: extension=php_openssl.dll; if it does not exist then shut down the http service, add the line and restart the http service.
- If you are using WAMP server then make sure you have enabled the Apache >>Apache modules>>ssl_module AND PHP>>Php extensions>>php_openssl
- You can try to call the built in test_email page from your browser at http://localhost/mantis/admin/test_email.php (this one actually tries to send an email to the address defined with $g_administrator_email [see above])
- If you are about to use gmail then you may have to authenticate mantis to access to your account. You can do this in you gmail account by going to your account -> security -> scroll down to Connected applications and sites and click manage access. If you are using this security feature of gmail then you have to use the generated password in your config_inc.php

If you still have problems with the emails you can try to create a purely php solution.

1, Unzip the attached file and copy the 'testmail.php' file in your htdocs (XAMPP) or www (WAMP) folder
2, Open it in notepad and edit the email address and the password
3, go to a browser and call the file (like http://localhost/testmail.php)
4, check your inbox

Please proceed these steps before asking for further help.

Re: Please read this if you have problems with emails

Posted: 06 Jan 2011, 13:16
by dregad
What I personally found useful in troubleshooting e-mail notifications on my LAMP, is to use a "fake" sendmail routine that logs whatever PHP mailer sends into a text file.

1. Save the script below somewhere (e.g. /tmp/fakesendmail), and make it executable (original from http://php.net/manual/en/book.mail.php)

Code: Select all

#!/usr/bin/php
<?php
    //====================================================
    // Program : Fake send mail
    // Author : pouletfou at gmail
    // Description : save this file as /usr/sbin/sendmail
    //  and you can test your PHP applications using mail
    //  by looking at the /tmp/fakesendmail.log files.
    //====================================================

    define('LOGFILE','/tmp/fakesendmail.log');

    $log = fopen (LOGFILE,'a+');

    fwrite($log,"\n".implode(' ',$argv)." called on : ".date('Y-m-d H:i:s')."\n");
    fwrite($log,file_get_contents("php://stdin"));
    fwrite($log, "\n===========================================================\n");

    fclose($log);

?>
2. Edit php.ini

Code: Select all

sendmail_path = /tmp/fakesendmail
3. Restart apache

Now whenever Mantis (or PHP) try to send a mail, you will see it in /tmp/fakesendmail.log

Hope this helps.
Damien

Re: Please read this if you have problems with emails

Posted: 26 Jan 2011, 14:13
by heldersepu
What if is still does not work...

I have my hosting with goDaddy, I was thinking that it was because of windows, but is not working on linux either:
windows:
http://sepuweb.com/mantisbt
linux:
http://heldersepu.com/mantisbt

and the testmail is giving errors:
http_//sepuweb.com/mantisbt/testmail.php

Re: Please read this if you have problems with emails

Posted: 03 Mar 2011, 22:55
by pinkiguana
I tried the solutions listed but I get this error msg and I don't know what it means

( ! ) Warning: require_once(Mail.php) [function.require-once]: failed to open stream: No such file or directory in D:\wamp\www\testmail.php on line 2
Call Stack
# Time Memory Function Location
1 0.0021 370064 {main}( ) ..\testmail.php:0

( ! ) Fatal error: require_once() [function.require]: Failed opening required 'Mail.php' (include_path='.;C:\php\pear') in D:\wamp\www\testmail.php on line 2
Call Stack
# Time Memory Function Location
1 0.0021 370064 {main}( ) ..\testmail.php:0

Re: Please read this if you have problems with emails

Posted: 10 May 2011, 02:38
by jet1415
Hi,

I'm using IIS 7 for my mantis 1.2.5 and I can't make the email work I did the settings you suggests but there are no emails been sent for the signup account.
Hope you can help me.

Thank you,
Carlo

Re: Please read this if you have problems with emails

Posted: 12 May 2011, 14:01
by istvanb
I have no idea, since I tested this a lot, and so far almost nobody experienced issues. The only guess I have is to try port 465, instead of 587. I dont think it would help though.

Re: Please read this if you have problems with emails

Posted: 15 May 2011, 19:55
by SugarD-x
jet1415 wrote:Hi,

I'm using IIS 7 for my mantis 1.2.5 and I can't make the email work I did the settings you suggests but there are no emails been sent for the signup account.
Hope you can help me.

Thank you,
Carlo
I have the same problem on the same version of IIS and Mantis. I tried the testmail.php file but all it does is cause an internal server error on the page when I access it. OpenSSL is enabled by default through PHP.

Re: Please read this if you have problems with emails

Posted: 15 Jul 2011, 09:08
by adam
Hello,

I'm facing this problem with email notification configuration.
Following the tutorial, when creating new account, I get the following error message :

Code: Select all

Data too long for column 'subject' at row 1 pour la requĂȘte : INSERT INTO mantis_email_table
 ( email,
 subject,
 body,
 submitted,
 metadata)
 VALUES
 ( ?,
 ?,
 ?,
 ?,
 ?
 ).
Can you tell me what I'm doing wrong ?

Thanks.

Re: Please read this if you have problems with emails

Posted: 25 Jul 2011, 14:52
by dientesverdes
I tried everithing you said in this post, but mantis can't send email notifications.

Mantis, always, show this error

SYSTEM WARNING: stream_socket_enable_crypto() [streams.crypto]: this stream does not support SSL/crypto
I don't know what else i can do. Can you help me?

I apologize for my english, i'm from latinamerica so i do my best. :D

Re: Please read this if you have problems with emails

Posted: 26 Jul 2011, 07:33
by atrol
Did you check this?
- If you are using WAMP server then make sure you have enabled the Apache >>Apache modules>>ssl_module AND PHP>>Php extensions>>php_openssl

Re: Please read this if you have problems with emails

Posted: 06 Sep 2011, 22:05
by sebastian.itplugs
hi
i tried all the steps above but i couldn't make it work
i'm using mantis 1.2.7 and xampp with php 3.5.3
i always get the fololowing answer when i try send an email: SYSTEM WARNING: stream_socket_enable_crypto() [streams.crypto]: this stream does not support SSL/crypto

i add the extension=php_openssl.dll; without sucess
testmail.php give me following error: Warning: implode() [function.implode]: Invalid arguments passed in C:\xampp\htdocs\testmail.php on line 15

could anyone help me to make the email sending work, please?

Re: Please read this if you have problems with emails

Posted: 27 Sep 2011, 19:47
by LVDantis
Greetings:
Earlier today, I discovered how to use the Due Date feature in Mantis when creating tickets. I find it very helpful that whomever is submtting the ticket can specify a due date and the ticket will turn red if the due date is past.

However, I noticed that when a ticket is submitted with a due date, the email that is received by the Administrators or the assignee doesn't show the due date.

Can someone please advise how to configure thiss so the email will show the due date?

Thank you.
Dan

Re: Please read this if you have problems with emails

Posted: 30 Sep 2011, 11:53
by cas
That is correct, field is not shown.
In order to do so, you would need to adjust function "email_format_bug_message" within core/email_api.php
Be aware that such change disapperas when upgrading to the new version.
Best is to request a change @ mantisbt.org/bugs :roll:

Re: Please read this if you have problems with emails

Posted: 20 Oct 2011, 12:27
by PREETHAM
Hello,

I have Installed MantisBT 1.2.8 version with XAMPP

The email settings done in the config_inc.php is has below:
$g_enable_email_notification = ON;
$g_phpMailer_method = PHPMAILER_METHOD_SMTP;
$g_from_email= 'xxxxxx@gmail.com';
$g_smtp_host= 'mail.xxxxx.com';
$g_smtp_username = 'xxxxx@xxxxxxx.com';
$g_smtp_password = 'xxxxxx';
$g_smtp_connection_mode = 'ssl';
$g_smtp_port = 25;

I am not able get any mail notification, the notifications are sitting in the DB but not reaching to the inbox.
I have tried with the testmail.php and it worked fine for me. Since I need to set up MBT very urgent, please guide me where would I have gone wrong?

Thanks,
Preetham

Re: Please read this if you have problems with emails

Posted: 07 Nov 2011, 17:50
by Jmills
Thank you, this resolved my issue with email functionality in mantis.

I had actually been entering this same configuration into config_defaults_inc.php
as opposed to config_inc.php
. :lol: