Quantcast
Channel: phpBB.com
Viewing all articles
Browse latest Browse all 2591

Extension Writers Discussion • Hook for failing email sends?

$
0
0
Recently, my board came across an issue where our email hosting provider changed the host SMTP URL. All emails began to fail (near-silently, ACP log errors only). This includes registration verification emails, and 'forgot your password' emails.

In the future, I'd like to get a noisier alert immediately if emails are not sending (specifically, not sending, not delivery failures). I'm planning to hook failed email sends up to a discord webhook. I tracked down this code snippet in functions_messenger.php

Code:

// Send message ...if (!$use_queue){$mail_to = ($to == '') ? 'undisclosed-recipients:;' : $to;$err_msg = '';if ($config['smtp_delivery']){$result = smtpmail($this->addresses, mail_encode($this->subject), wordwrap(utf8_wordwrap($this->msg), 997, "\n", true), $err_msg, $headers);}else{$result = phpbb_mail($mail_to, $this->subject, $this->msg, $headers, $encode_eol, $err_msg);}if (!$result){$this->error('EMAIL', $err_msg);return false;}}else{$this->queue->put('email', array('to'=> $to,'addresses'=> $this->addresses,'subject'=> $this->subject,'msg'=> $this->msg,'headers'=> $headers));}
Which looks like it logs the ACP errors when an email send $result is false.

Honestly, its been a few years since I've been in the phpbb ext trenches, but I do remember that phpbb has event hooks that can be used to add functionality to specific segments of the core code base. Where might I go to request an event be added to this area? Is there already an event available for something like this I could use?

Statistics: Posted by vipaka — Wed Jul 02, 2025 12:14 am



Viewing all articles
Browse latest Browse all 2591

Trending Articles