What is an Event? When something important happens inside php-smtp, for example a user successfully authenticates, sends a message, or a message is bounced, an event is issued. The event handler in the API then calls all registered user-defined callbacks, sending each data about the event.
How do I register an Event callback? Use the following code in "callbacks.php":
What is a Hook? Sometimes custom action can be taken within the core of php-smtp. For example, when a user sends authentication credentials, you may want to query an MySQL database, an LDAP server, or even a local plain text file in order to authenticate them. When php-smtp reaches one of these points, it calls all registered user-defined callbacks, and utilizes their boolean return values to determine what action to take.
How are Hooks different from Events? Unlike Event callbacks, Hook callbacks are expected to return "true" or "false". Hooks alter the way php-smtp works internally, Event callbacks are simply notified of something having happened.
How do I register a Hook callback? Use the following code in "callbacks.php":
Copyright (c) 2008 Jason Johnson