Page 1 of 1

Difficulty with emailing.

Posted: 07 May 2014, 18:30
by jkpalmer52
Running Mantis on a shared server

1AND1 is my provider

Formerly - On MantisBT 1.1.2 -

I used to be able to send email via CRONJOB using the following command:

php mantissave/core/send_emails.php; This process worked flawlessly

I've recently migrated to MantisBT 1.2.17 and copied my config_inc.php from my old mantis folder to my new mantis folder and did not make any changes.

I try to run the following command in my CRONJOB:
php mantisbt-1.2.17/scripts/send_emails.php;

and I am receiving the error -

send_emails.php is not allowed to run through the webserver.

I'm not very good at understanding email servers, etc. so help would be greatly appreciated.

Jim P.

Re: Difficulty with emailing.

Posted: 07 May 2014, 19:30
by atrol
Make a copy of send_emails.php
Open send_emails.php in editor and add the following line before the line exit( 1 )

Code: Select all

        echo  php_sapi_name();
Which output do you get now?

Try also if it works after removing the line exit( 1 )

Re: Difficulty with emailing.

Posted: 07 May 2014, 20:07
by jkpalmer52
I have modified the code as you have described:

if( php_sapi_name() != 'cli' ) {
echo "send_emails.php is not allowed to run through the webserver.\n";
echo php_sapi_name(); <----New line
exit( 1 );

When I execute the statement from CLI, the value that is returned from the echo that I added is cgi-fcgi

I commented out the exit(1) statement and now emails are being processed.

Re: Difficulty with emailing.

Posted: 08 May 2014, 19:07
by atrol
Ok, it works but it's no clean solution.
You could check if your provide offers also a php-cli command.
If so, you could try using this one in your cron job.
Maybe this works without changing send_emails.php
e.g. php-cli mantisbt-1.2.17/scripts/send_emails.php;