Email is not working on 1.2.19

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
vijaykrajpoot
Posts: 1
Joined: 07 Sep 2015, 10:08

Email is not working on 1.2.19

Post by vijaykrajpoot »

Hi, Thanks for viewing this message.
I have downloaded mantisbt-1.2.19 and install successfully on Centos 7. Emails are not working ,I have tried various combinations and read all most all the post available on MantisBT forum and other sites too.

I have following configuration of config_inc.php for email configuration.

# --- Email Configuration ---
$g_enable_email_notification = ON;
$g_phpMailer_method = PHPMAILER_METHOD_SMTP; # or PHPMAILER_METHOD_SMTP, PHPMAILER_METHOD_SENDMAIL
$g_smtp_host = 'smtp.office365.com'; # used with PHPMAILER_METHOD_SMTP
$g_smtp_username = 'username'; # used with PHPMAILER_METHOD_SMTP
$g_smtp_password = 'XXXXX'; # used with PHPMAILER_METHOD_SMTP
$g_smtp_port = 587;
$g_smtp_connection_mode = 'tls';
$g_administrator_email = 'vijaykrajpoot@gmail.com';
$g_webmaster_email = 'valid_email';
$g_from_email = 'valid_email; # the "From: " field in emails
$g_return_path_email = 'valid_email'; # the return address for bounced mail
$g_debug_email = ON;
$g_log_level = LOG_EMAIL | LOG_FILTERING | LOG_AJAX | LOG_DATABASE | LOG_LDAP;
$g_log_destination = 'file:/tmp/mantis.log';
$g_from_name = 'Mantis Bug Tracker';
$g_email_receive_own = ON;
# $g_email_send_using_cronjob = OFF;


I have tried - http://server_ip/mantisbt/admin/test_email.php which shows following error on GUI
Testing Mail - PROBLEMS SENDING MAIL TO: userid@gmail.com. Please check your php/mail server settings.

I have already followed - viewtopic.php?f=3&t=15398 and uses http://server_ip/testmail.php its working fine. Please see below details of testmail.php for same smtp server.

<?php
echo("<p>Message setting up</pi>");
require_once "Mail.php";
$from = "from_email";
$to = "vijaykrajpoot@gmail.com"; //CHANGE THIS TO YOUR GMAIL ADDRESS WELL
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";

$host = "smtp.office365.com";
$port = "587";
$username = "user_name"; //CHANGE THIS TO YOUR GMAIL ADDRESS WELL
$password = "XXXXXX"; //CHANGE THIS TO YOUR GMAIL PASSWORD
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'port' => $port,
'auth' => true,
'debug'=>true,
'username' => $username,
'password' => $password));
$mail = $smtp->send($to, $headers, $body);
echo("<p>Sending email....</p>");

if (PEAR::isError($mail)) {
echo("<p>" . $mail->getUserInfo() . "</p>");
echo("<p> Mail Info: " . $mail->getMessage() . "</p>");
} else {
echo("<p>Message successfully sent!</p>");
}
?>



I tried https://mantisbt.org/forums/viewtopic.p ... 03&p=58026 also and updated email_api.php as well as admin/test_email.php but it looks like $result is null.

Code: Select all

//in email_send() function:

   catch ( phpmailerException $e )
   {
[b]      $t_success = $e->errorMessage();[/b]
   }

In admin/test_email.php

Code: Select all

$result = email_send( $t_email_data );

         # $result = email_send( config_get_global( 'administrator_email' ), 'Testing PHP mail() function',   'Your PHP mail settings appear to be correctly set.');

[b]      echo ' email_send() result is###: ' . $result;[/b]
         

         if( $result ) {
Out put : Testing Mail - email_send() result is###: PROBLEMS SENDING MAIL TO: vijay.kumar@letmecall.com. Please check your php/mail server settings.

As per document its looks like super easy but this email configuration is making me more nervous. Please let me know what wrong am I doing.
bassmonk
Posts: 8
Joined: 04 Jul 2015, 15:19

Re: Email is not working on 1.2.19

Post by bassmonk »

Try this:

You need to allow access "Allow less secure apps: ON" from https://myaccount.google.com/u/1/securi ... nectedapps

Due to Google sign in policy it wont allow you to send emails.

Hope it works....best of luck

Thanks!
Post Reply