Please read this if you have problems with emails

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
istvanb
Posts: 226
Joined: Aug 22, 2010 4:00 pm

Please read this if you have problems with emails

Post by istvanb » Dec 02, 2010 11:38 am

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.
Attachments
testmail.zip
(872 Bytes) Downloaded 10981 times
Last edited by istvanb on Mar 24, 2013 8:10 pm, edited 2 times in total.

dregad
Developer
Posts: 43
Joined: Jul 26, 2010 9:24 am

Re: Please read this if you have problems with emails

Post by dregad » Jan 06, 2011 8:16 am

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

heldersepu
Posts: 2
Joined: Jan 26, 2011 8:31 am

Re: Please read this if you have problems with emails

Post by heldersepu » Jan 26, 2011 9:13 am

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

pinkiguana
Posts: 2
Joined: Mar 20, 2008 10:20 am

Re: Please read this if you have problems with emails

Post by pinkiguana » Mar 03, 2011 5:55 pm

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

jet1415
Posts: 3
Joined: May 09, 2011 12:30 am

Re: Please read this if you have problems with emails

Post by jet1415 » May 09, 2011 9:38 pm

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

istvanb
Posts: 226
Joined: Aug 22, 2010 4:00 pm

Re: Please read this if you have problems with emails

Post by istvanb » May 12, 2011 9:01 am

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.

SugarD-x
Posts: 5
Joined: May 15, 2011 2:53 pm

Re: Please read this if you have problems with emails

Post by SugarD-x » May 15, 2011 2:55 pm

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.

adam
Posts: 9
Joined: Jul 15, 2011 4:04 am

Re: Please read this if you have problems with emails

Post by adam » Jul 15, 2011 4:08 am

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.

dientesverdes
Posts: 1
Joined: Jul 14, 2011 11:44 am

Re: Please read this if you have problems with emails

Post by dientesverdes » Jul 25, 2011 9:52 am

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

atrol
Site Admin
Posts: 7689
Joined: Mar 26, 2008 4:37 pm
Location: Germany

Re: Please read this if you have problems with emails

Post by atrol » Jul 26, 2011 2:33 am

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
Please use Search before posting and read the Manual

sebastian.itplugs
Posts: 1
Joined: Sep 06, 2011 4:59 pm

Re: Please read this if you have problems with emails

Post by sebastian.itplugs » Sep 06, 2011 5:05 pm

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?

LVDantis
Posts: 2
Joined: Sep 27, 2011 2:37 pm

Re: Please read this if you have problems with emails

Post by LVDantis » Sep 27, 2011 2:47 pm

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
Attachments
due date ss2.png
due date ss2.png (45.02 KiB) Viewed 138178 times
due date ss.png
Due Date Missing Screen Shot
due date ss.png (47.13 KiB) Viewed 138180 times

cas
Posts: 690
Joined: Mar 11, 2006 11:08 am
Contact:

Re: Please read this if you have problems with emails

Post by cas » Sep 30, 2011 6:53 am

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:

PREETHAM
Posts: 1
Joined: Oct 20, 2011 7:08 am

Re: Please read this if you have problems with emails

Post by PREETHAM » Oct 20, 2011 7:27 am

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

Jmills
Posts: 1
Joined: Nov 07, 2011 12:00 pm

Re: Please read this if you have problems with emails

Post by Jmills » Nov 07, 2011 12:50 pm

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:

Post Reply