I am currently working on an Email Server program that will keep track of emails that are sent via my website/web apps, and retry any that may fail due to SMTP errors.
What I am looking at being able to do is to replace the default method that PHP uses to send email.
I’ve tried creating a php script that has the same parameters as the mail function and adding this script to the sendmail path in the php.ini file but when I try this the browser just sits their not doing anything.
The idea is that the user would only need to reconfigure php to use my own version instead of having to write different code, i.e. they can the exactly the same code that they currently use to send email via php but instead of php doing the send, it just passes the details required to my own version to pass it on to the email server.
Is this something that this possible, thanks for any help you can provide
If you have the
runkitextension installed, you may be interested in usingrunkit_function_redefineto override theemailfunction. Unfortunately, with PHP, native overriding of functions is not supported.Reference: http://ca.php.net/runkit
Reference: http://ca.php.net/manual/en/function.runkit-function-redefine.php
Otherwise, you may also try and give
override_functiona shot.Reference: http://php.net/manual/en/function.override-function.php
Enjoy and good luck!