How to hook PHP mail() function

There are times when you may need to hook some PHP function for one reason or another. PHP makes it an easy task to accomplish using override_function which overrides built-in functions. This is useful only in the context of your own code or the code you can easily change in order to work with the aforementioned function. So, this solution might not be always at your disposal.

Specifically, let’s take a deeper look into the PHP mail function which is frequently used and misused in various scripts.

Continue reading “How to hook PHP mail() function”