Overview
Comment: | Add email.bounce signal |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | emails |
Files: | files | file ages | folders |
SHA3-256: |
452c5a76ed40114c6763fa6a8f1269a2 |
User & Date: | bohwaz on 2022-05-31 22:34:17 |
Other Links: | branch diff | manifest | tags |
Context
2022-05-31
| ||
22:35 | Make sure to create the email address if required check-in: 6e5d06ddc5 user: bohwaz tags: emails | |
22:34 | Add email.bounce signal check-in: 452c5a76ed user: bohwaz tags: emails | |
21:52 | Add contrast to datepicker sundays check-in: 1f19f2b41f user: bohwaz tags: emails | |
Changes
Modified src/include/lib/Garradin/Users/Emails.php from [391c99f4a3] to [2c4ed7c38a].
︙ | ︙ | |||
453 454 455 456 457 458 459 | Plugin::fireSignal('email.send.after', compact('context', 'message')); } /** * Handle a bounce message * @param string $raw_message Raw MIME message from SMTP */ | | | | | > > > | 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 | Plugin::fireSignal('email.send.after', compact('context', 'message')); } /** * Handle a bounce message * @param string $raw_message Raw MIME message from SMTP */ static public function handleBounce(string $raw_message): ?array { $message = new Mail_Message; $message->parse($raw_message); $return = $message->identifyBounce(); if ($return['type'] == 'autoreply') { // Ignore auto-responders return $return; } elseif ($return['type'] == 'genuine') { // Forward emails that are not automatic to the organization email $config = Config::getInstance(); $new = new Mail_Message; $new->setHeaders([ 'To' => $config->email_asso, 'Subject' => 'Réponse à un message que vous avez envoyé', ]); $new->setBody('Veuillez trouver ci-joint une réponse à un message que vous avez envoyé à un de vos membre.'); $new->attachMessage($message->output()); self::sendMessage(self::CONTEXT_SYSTEM, $new); return $return; } $email = self::getEmail($return['recipient']); if (!$email) { return null; } Plugin::fireSignal('email.bounce', compact('email', 'return')); $email->hasFailed($return); $email->save(); return $return; } /** * Create a mass mailing */ static public function createMailing(array $recipients, string $subject, string $message, bool $send_copy, ?string $render): \stdClass { |
︙ | ︙ |