Search

Search for:
Language:  

No categories for selected product

Many email messages are sent from PHP scripts on the server. How can I find the domains on which these scripts are running?

Article ID: 1711 
Last Review: May, 3 2012
Views:
APPLIES TO:
  • Parallels Plesk Panel

Resolution

There is a way to determine from what folder the PHP script that sends mail was run. Note: Depending on your OS and Plesk version, the paths can slightly differ from those listed below.

1) Create a /var/qmail/bin/sendmail-wrapper script with the following content:

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


Note, it should be two lines including '#!/bin/sh'.

2) Create a log file /var/tmp/mail.send and grant it "a+rw" rights; make the wrapper executable; rename old sendmail; and link it 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 for an hour and change back sendmail:

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


Examine the /var/tmp/mail.send file. There should be lines starting with "X-Additional-Header:" pointing to domain folders where the scripts which sent the mail are located.
You can see all the folders from where mail PHP scripts were run with the following command:

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

If you see no output from the above command, it means that no mail was sent using the PHP mail() function from the Plesk virtual hosts directory.





Email subscription for changes to this article Email subscription for changes to this article

Please provide feedback on this article

* Did this article help you solve your issue?
Yes
No
What can we do to improve this article?

PLEASE NOTE: Knowledge Base feedback is reviewed occasionally and we do not reply to most of the individual comments. Please contact us using one of the Support channels for a response to any support inquiries. We appreciate your feedback.

Subscribe me for article updates. My email
 
 
 
 
 
 
For Home
For Hosters
For SaaS
For IaaS
For Developers
For Health Care
 
Desktop Virtualization
- Parallels Desktop 7 for Mac
- Parallels Transporter
- Parallels Mobile
- Parallels Desktop Switch to Mac Edition
- Parallels Workstation
- Parallels Workstation Extreme
- Parallels Desktop for Mac Enterprise Edition
Server Virtualization
- Parallels Server for Mac 4.0
- Parallels Server for Mac 4.0 Mac mini Edition
- Parallels Server for Mac Bare Metal Edition
- Parallels Server Bare Metal
- Parallels Virtuozzo Containers
Automation
- Parallels Operations Automation
- Parallels Automation for Cloud Infrastructure
- Parallels Business Automation
- Parallels Business Automation Standard
- Parallels Virtual Automation
- Parallels Plesk Panel Suite
- Parallels Small Business Panel
- Parallels Domain/SSL Reseller Program
- Parallels Partner Storefront
More Products