Difficulty with emailing.

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
jkpalmer52
Posts: 78
Joined: 23 Feb 2005, 17:29
Location: US-Chicago area

Difficulty with emailing.

Post 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.
atrol
Site Admin
Posts: 8542
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Difficulty with emailing.

Post 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 )
Please use Search before posting and read the Manual
jkpalmer52
Posts: 78
Joined: 23 Feb 2005, 17:29
Location: US-Chicago area

Re: Difficulty with emailing.

Post 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.
atrol
Site Admin
Posts: 8542
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Difficulty with emailing.

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