#19538 [Asn]: No way to identify source of email sent by mail()

From: Date: Wed, 23 Oct 2002 22:30:13 +0000
Subject: #19538 [Asn]: No way to identify source of email sent by mail()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-23142@lists.php.net to get a copy of this message
 ID:               19538
 User updated by:  misiek@pld.org.pl
 Reported By:      misiek@pld.org.pl
 Status:           Assigned
 Bug Type:         Feature/Change Request
 Operating System: ALL
 PHP Version:      4.2.3
 Assigned To:      derick
 New Comment:

Thats exactly it! Derick assigned this task but he is afaik busy and
won't implement this soon. Too bad but I'm patient :-)


Previous Comments:
------------------------------------------------------------------------

[2002-10-23 17:24:55] beckman@purplecow.com

Ah, I see.  So you want to be able to have a php.ini directive like
this:

  add_mail_headers = "X-PHP-Script:
{$_SERVER[HTTP_HOST]}{$_SERVER[REQUEST_URI]}\nX-Contact-If-Spammed:
Contact Information\n";

So that every mail() call will add that line.  I think that is a valid
request, especially since a badly formed script can really mess things
up.  It would default to "", and if it was not properly written it
would be ignored.

By making it configurable, admins can choose to add or remove global
mail headers.  I think this would be very useful for installs which
serve lots of customers.

------------------------------------------------------------------------

[2002-10-23 16:01:30] misiek@pld.org.pl

I can't modify my customers scripts. Scripts are changing frequently,
new customers upload new scripts and so on. Anyway:
[root@gucio customers]# grep -ri 'mail(' . | wc -l
   2873

Changing 2873 not mine script means ,,introduce some bugs'', too.

Basically I want feature that does similar thing to yours but
configurable globally from php.ini.

------------------------------------------------------------------------

[2002-10-23 15:09:47] beckman@purplecow.com

This is easily solved:

mail("user@host.com","Subject Line","Body","X-PHP-Mailer-Script:
{$_SERVER[HTTP_HOST]}{$_SERVER[REQUEST_URI]}\nX-PHP-Mailer-Path:
{$_SERVER[SCRIPT_FILENAME]}\nX-PHP-Remote-IP:
{$_SERVER[REMOTE_ADDR]");

This will add three new headers to this mail:

X-PHP-Mailer-Script: yourwebhost.com/path/to/script.php
X-PHP-Mailer-Path: /real/path/to/script.php
X-PHP-Remote-IP: 10.20.30.40

And now you'll know which script the spammer is using.

------------------------------------------------------------------------

[2002-09-22 04:58:05] misiek@pld.org.pl

Sorry but you are simply wrong. MTA logs don't contain any usefull
information.

------------------------------------------------------------------------

[2002-09-21 19:51:59] xx-nospam-php@BrazilianTranslation.net

IMHO, sendmail's (or whatever MTA you're using) logs should give that
kind of information away, not headers produced by PHP.

Luciano ES
Santos, SP - Brasil

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/19538

-- 
Edit this bug report at http://bugs.php.net/?id=19538&edit=1



Thread (15 messages)

« previous php.bugs (#23142) next »