Skip to content

Muchos emails se envían desde scripts PHP en el servidor. How do I know which domains are running these scripts?

Resolution

There is a way to find out from which folder the PHP script that sent the message is executed. Tenga en cuenta que las rutas pueden ser un poco distintas de las enumeradas a continuación, ya que estas varían en función de su versión de Parallels Plesk Panel y de su SO:

1) cree /var/qmail/bin/sendmail-wrapper script con el contenido:

#!/bin/sh
(echo X-Additional-Header: $PWD ;cat) | tee -a /var/tmp/mail.send|/var/qmail/bin/sendmail-qmail “$@”

Es muy importante incluir estas dos líneas, incluyendo ‘#!/bin/sh’.

 

2) ahora cree el archivo de registro /var/tmp/mail.send y otórguele derechosa+rw”. Haga que el ‘wrappersea ejecutable, change the previous sendmail name and link to the new wrapper:

 

# touch /var/tmp/mail.send# chmod a rw /var/tmp/mail.send

# chmod a x /var/qmail/bin/sendmail-wrapper

# mv / var / qmail / bin / sendmail / var / qmail / bin / sendmail-qmail

# ln -s /var/qmail/bin/sendmail-wrapper /var/qmail/bin/sendmail

3) Wait about an hour and revert sendmail:

# rm -f /var/qmail/bin/sendmail
# ln -s /var/qmail/bin/sendmail-qmail /var/qmail/bin/sendmail

Examine the / var / tmp / mail.send, should find a line starting with “X-Additional-Header:” pointing to the folder where the script domains that the mail is sent.
También verá todas las carpetas desde las que se ejecutaron los scripts de correo PHP ejecutando el siguiente comando:

# grep X-Additional /var/tmp/mail.send | grep `cat /etc/psa/psa.conf | grep HTTPD_VHOSTS_D | sed -e 's/HTTPD_VHOSTS_D//' `

If indicated above command does not return any output, means that there is no mail sent using PHP mail function () from the virtual hosts directory of Parallels Plesk Panel.

 

SOURCE: http://kb.parallels.com/es/1711