| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Mail\Hook; |
| 4 | |
| 5 | use MailAddress; |
| 6 | use MediaWiki\Mail\UserEmailContact; |
| 7 | use MediaWiki\Permissions\Authority; |
| 8 | use StatusValue; |
| 9 | |
| 10 | /** |
| 11 | * This is a hook handler interface, see docs/Hooks.md. |
| 12 | * Use the hook name "EmailUserSendEmail" to register handlers implementing this interface. |
| 13 | * |
| 14 | * @stable to implement |
| 15 | * @ingroup Hooks |
| 16 | * @since 1.41 |
| 17 | */ |
| 18 | interface EmailUserSendEmailHook { |
| 19 | /** |
| 20 | * This hook is called before sending an email, when all other checks have succeeded. |
| 21 | * |
| 22 | * @param Authority $from |
| 23 | * @param MailAddress $fromAddress MailAddress of the sender |
| 24 | * @param UserEmailContact $to |
| 25 | * @param MailAddress $toAddress MailAddress of the target |
| 26 | * @param string $subject |
| 27 | * @param string $text |
| 28 | * @param StatusValue $status Add any error here |
| 29 | * @return bool|void True or no return value to continue. To abort, return false and add a fatal error to $status. |
| 30 | */ |
| 31 | public function onEmailUserSendEmail( |
| 32 | Authority $from, |
| 33 | MailAddress $fromAddress, |
| 34 | UserEmailContact $to, |
| 35 | MailAddress $toAddress, |
| 36 | string $subject, |
| 37 | string $text, |
| 38 | StatusValue $status |
| 39 | ); |
| 40 | } |