Determining the source domain for emails generated from PHP scripts
Overview
To determine the domain for the PHP script that is sending mail, please follow the commands below.
Instructions
-
Create /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 "$@" -
Create 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.sendchmod a+rw /var/tmp/mail.sendchmod a+x /var/qmail/bin/sendmail-wrappermv /var/qmail/bin/sendmail /var/qmail/bin/sendmail-qmailln -s /var/qmail/bin/sendmail-wrapper /var/qmail/bin/sendmail -
Wait for an hour or so and revert sendmail back:
rm -f /var/qmail/bin/sendmailln -s /var/qmail/bin/sendmail-qmail /var/qmail/bin/sendmail -
Examine /var/tmp/mail.send file. There should be lines starting with "X-Additional-Header:" pointing out to domain folder where the script which sent the mail is located. The command below will provide more specific information:
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 don't see any output from the command above, than no mail was sent using the PHP mail() function from the domains configured in Plesk.
User Comments
No visitor comments posted. Post a comment
Fields marked with an asterisk(*) are required. Comment on this article