• Introducing WebPros Cloud - a fully managed infrastructure platform purpose-built to simplify the deployment of WebPros products !  WebPros Cloud enables you to easily deliver WebPros solutions — without the complexity of managing the infrastructure.
    Join the pilot program today!
  • Support for BIND DNS has been removed from Plesk for Windows due to security and maintenance risks.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS.

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 [email protected] -redirect true -rediraddr [email protected]

And by invoking:

sudo /usr/local/psa/bin/mail -u [email protected] -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 [email protected] 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