note 87653 added to function.mail

From: Date: Mon, 15 Dec 2008 02:59:26 +0000
Subject: note 87653 added to function.mail
Groups: php.notes 
Request: Send a blank email to php-notes+get-148166@lists.php.net to get a copy of this message
I tried the example provided by <a href="#78934">[hn at nesland dot net]</a> but it didn't quite work, as the error: Fatal error: Cannot redeclare mail() was encountered. Also, the runkit_function_rename() caused apache to exit with Segmentation fault (11) This works like a charm: <?PHP @dl("runkit.so"); @runkit_function_copy("mail", "__org_mail"); @runkit_function_remove("mail"); @runkit_function_copy("__new_mail", "mail"); @runkit_function_remove("__new_mail"); function __new_mail($to, $subject, $message, $additional_headers = null, $additional_parameters = null) { /* do your own mail function checks here */ return __org_mail($to, $subject, $message, $additional_headers, $additional_parameters); } ?> Atleast it worked for me, stripping newlines from $to, $subject, removing unwanted headers from $additional_headers and adding new headers to $additional_headers for debugging - this way I'll be able to track the origin of the mail using the headers. You'll need enable_dl = On in your php.ini and also runkit.internal_override = "1" I wanted to remove the execution of __org_mail(), so I tried to add this to disable_functions in php.ini but that didn't seem to work, so be aware that the original function can still be executed, and found by using get_defined_functions(). ---- Server IP: 87.54.44.10 Probable Submitter: 212.242.112.108 ---- Manual Page -- http://www.php.net/manual/en/function.mail.php Edit -- https://master.php.net/note/edit/87653 Del: integrated -- https://master.php.net/note/delete/87653/integrated Del: useless -- https://master.php.net/note/delete/87653/useless Del: bad code -- https://master.php.net/note/delete/87653/bad+code Del: spam -- https://master.php.net/note/delete/87653/spam Del: non-english -- https://master.php.net/note/delete/87653/non-english Del: in docs -- https://master.php.net/note/delete/87653/in+docs Del: other reasons-- https://master.php.net/note/delete/87653 Reject -- https://master.php.net/note/reject/87653 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#148166) next »