Jump to content

Hook for sending mail


joey102030
 Share

Recommended Posts

I know it is standard for a PHP setup to have a working mail() function, but I'm doing some work on a server where the local SMTP server has been disabled.

While it's fairly trivial to set the SMTP server global variable to a remote server, it's impossible to setup authentication into the remote SMTP server.

Therefore it would be useful to be able to hook into any functions which send email (eg forgotten password for admin login) and override it with phpMailer (or similar).

  • Like 2
Link to comment
Share on other sites

I find this useful. And I have searched the core code (wire) and found only three function calls:

  1. https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/core/shutdown.php#L73
  2. https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/modules/Process/ProcessForgotPassword.module#L166
  3. https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/modules/Fieldtype/FieldtypeComments/FieldtypeComments.module#L290

It could be replaced by a hookable function called pwMail() or something like that.

public function ___pwMail($to, $subject, $message, $additional_headers=null, $additional_parameters=null) {
	return @mail($to, $subject, $message, $additional_headers, $additional_parameters);
}
Edited by horst
  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...