• Dear Pleskians! The Plesk Forum will be undergoing scheduled maintenance on Monday, 7th of July, at 9:00 AM UTC. The expected maintenance window is 2 hours.
    Thank you in advance for your patience and understanding on the matter.

mail.sh partially not working when invoked from PHP

G

gregi

Guest
Hello all

I'm encountering a strange problem. When I call mail.sh from the Shell like below, the redirection works just well:

sudo /usr/local/psa/bin/mail -u gregi@xyz.ch -redirect true -rediraddr gregi@lunarice.ch

And by invoking:

sudo /usr/local/psa/bin/mail -u gregi@xyz.ch -redirect false

the redirection gets removed as well.

Now the strange thing is, when I invoke the very same commands from a PHP script using the exec() or system() function, the mail-script returns in both cases SUCCESS, the redirection is sucessfully created after the first command, but not removed after the second command - although mail -i gregi@xyz.ch tells me that the redirection *is* removed, even the Plesk Interface tells me that. But it isn't, since I get the mails redirected furthermore ;)

There is no chance now to remove the redirection than by redoing the redirection command from the Shell and re-removing it form the shell (this does also work from the Plesk-Interface). Just doing the remove-command from the shell doesn't help, I have to do both in order to get the redirection removed.

By the way, my /etc/sudoers contains
apache ALL= NOPASSWD: /usr/local/psa/bin/mail *
The sudo-thing is working, since when doing the same procedure above not with the apache-user but with another unprivileged user (after changing the /etc/sudoers of course), everything works es expected.

Now does anyone have an idea about this strange behaviour?

Thanks in andvance and greetings from switzerland
Greg
 
[cancel] mail.sh partially not working when invoked from PHP

Okay, I've just found what my very mistake was... I was doing a

UPDATE psa.mail SET redir_addr = '' WHERE id = 100

before deactivating the redirection, and it seems the mail-script didn't like that. To get around this problem I've just swapped the order of my commands, i.e. I invoke the mail-script with the redirection-delete first and second I invoke my DB update to get rid of the redirect-address.

Well, perhaps this sometime helps someone :)

Greetings,
Greg
 
Back
Top