dotproject / dotProject

Stable 2 series
Other
207 stars 106 forks source link

DotProject Can't send emails, how to fix ? #85

Open muhammadkohail opened 5 years ago

muhammadkohail commented 5 years ago

Hi, im trying to run (sending emails feature) in dotproject while: 1- my current mail server is outside the one which i uploaded the files on 2- i tried these steps in (System Configuration) :

3- i tried to make a new log, and choose emails 4- i got the log saved with these details:

(( Emailed 15/07/2019 14:52:18 to: myuser@mydomain.com (myuser@mydomain.com) ))

5- i did't get any emails sent to my account 6- i tried those fixes https://github.com/dotproject/dotProject/issues/36

and there is no results too, can you help me plz ?

muhammadkohail commented 5 years ago

@ajdonnison please help

ajdonnison commented 5 years ago

@muhammadkohail if you set Queued email it won't send it unless you have either a cron job to run the queue runner or you have also set Scan Event Queue on Session Garbage Collection in theSession Handling Settings` in System Admin.

If you want to test the email settings, in the System Admin main menu you will see at the bottom of the screen Send Test Email.

muhammadkohail commented 5 years ago

i did that (Scan Event Queue on Session Garbage Collection in the Session Handling Settings` in System Admin) but NO results found yet. please advice

muhammadkohail commented 5 years ago

@ajdonnison

muhammadkohail commented 5 years ago

Look, i changed the main way like this: 1 - i created mail server on the current domain which dotproject setup-ed on 2 - i did the system configuration like this:

is that right ?

muhammadkohail commented 5 years ago

@ajdonnison please help

ajdonnison commented 5 years ago

Did you try using the "Send Test Email" function? Also, uncheck the queue email option until you make sure the email is working - one problem at a time.

ajdonnison commented 5 years ago

The other thing you can do is point your browser to queuescanner.php which will run anything caught in the queue.

muhammadkohail commented 5 years ago

Did you try using the "Send Test Email" function? Also, uncheck the queue email option until you make sure the email is working - one problem at a time.

muhammadkohail commented 5 years ago

queuescanner.php

How i can do that in code steps and lines please ?

muhammadkohail commented 5 years ago

Did you try using the "Send Test Email" function? Also, uncheck the queue email option until you make sure the email is working - one problem at a time.

* Yes, i did "Send Test Email" as i told, i did the all fixing points in the 3 editet files which you uploaded

* I removed now the checked on "queue email option", but the page "Send Test Email" still loading with NO finish

504 Gateway Time-out nginx/1.15.10

muhammadkohail commented 5 years ago

queuescanner.php

How i can do that in code steps and lines please ?

<?php // $Id$

/* All files in this work, except the modules/ticketsmith directory, are now covered by the following copyright notice. The ticketsmith module is under the Voxel Public License. See modules/ticketsmith/LICENSE for details. Please note that included libraries in lib may have their own license.

Copyright (c) 2003-2005 The dotProject Development Team core-developers@dotproject.net

This file is part of dotProject.

dotProject is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

dotProject is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with dotProject; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

The full text of the GPL is in the COPYING file. */

// Function to scan the event queue and execute any functions required.

require_once 'base.php';
require_once DP_BASE_DIR.'/includes/config.php';
require_once DP_BASE_DIR.'/includes/main_functions.php';
require_once DP_BASE_DIR.'/includes/db_connect.php';
require_once DP_BASE_DIR.'/classes/ui.class.php';
require_once DP_BASE_DIR.'/classes/event_queue.class.php';
require_once DP_BASE_DIR.'/classes/query.class.php';

$AppUI = new CAppUI;
$AppUI->setUserLocale();
$perms =& $AppUI->acl();

echo "Scanning Queue ...\n";
$queue = EventQueue::getInstance();
# Determine if we are called from the command line or from a web page,
# In either case we may have an argument telling us if we are scanning
# the batch or the immediate queue.  If no argument, scan everything.
$batch = null;
if (isset($_REQUEST['batch'])) {
    $batch = strtolower($_REQUEST['batch']);
} else if (isset($argv) && !empty($argv[1])) {
    $batch = strtolower($argv[1]);
}
if (!empty($batch)) {
    if ( is_numeric($batch)) {
        $batch = intval($batch);
        if ($batch[0] == 'y' || $batch[0] == 't') {
            $batch = 1;
        } else {
            $batch = 0;
        }
    }
    if ($batch) {
        $queue->scanBatched();
    } else {
        $queue->scanImmediate();
    }
} else {
    $queue->scan();
}
echo 'Done, '.$queue->eventCount().' events processed'."\n";
ajdonnison commented 5 years ago

If your web server is set up correctly, pointing a browser to queuescanner.php will run it as a PHP file and not display the file contents as it appears to have done. If you want to run it from a command line you'd use php queuescanner.php.

The timeout information seems to suggest that it is a network issue rather than a code issue. If you have access to the server can you try debugging the connection? Either using tcpdump to see if the connection is being made and responded to, or use telnet to ensure the connection details are correct.

Also look at the nginx error log to see if there is anything of use there.

muhammadkohail commented 5 years ago

out informatio

the connection is good, and the system is running well but emails also, i tried to point queuescanner.php on my browser and i got (504 Gateway Time-out), there is a long loading while the other files can be run fast ! please advice with anyway Note: the code which i sent to you wasnt from pointing my browser, i got it from inside the file from cpanel

ajdonnison commented 5 years ago

A couple of things, "the connection is good", how do you know? What tests have you done? Can you connect to port 465 from the server? If so, what did you do to test that?

As for the timeout, I've already said that the most likely issue is that it isn't able to connect to the mail server, so the fact that other files run fast is completely irrelevant. If the send test email page is also hanging - therein lies your problem. Set the timeout to a smaller value so you don't hit the default PHP execution time limit - say 10 seconds. Then try the test page again, if nothing else you should at least see an error coming back. The default execution timeout on PHP is 30 seconds, so if you haven't altered that it will be kicking in before your SMTP timeout. The fact that either timeout is triggered means that the server connection details are wrong, or there is a network issue, or something else causing the connection issue.

You said that the mail server is "on the same domain", does that mean it is on the same server? Is it listening to the local loopback network?