← All changes
|
app/Services/TransactionalEmailTemplateService.php
+21
-1
3.0.15
→
3.0.17
View file →
| @@ -518,14 +518,34 @@ | ||
| 518 | 518 | } |
| 519 | 519 | |
| 520 | 520 | $rendered = self::render($type, $variables); |
| 521 | 521 | |
| 522 | - return EmailService::send( | |
| 522 | + $sent = EmailService::send( | |
| 523 | 523 | $to, |
| 524 | 524 | $rendered['subject'], |
| 525 | 525 | $rendered['body'], |
| 526 | 526 | ['Content-Type: text/html; charset=UTF-8'] |
| 527 | 527 | ); |
| 528 | + | |
| 529 | + /** | |
| 530 | + * A transactional email core just sent. | |
| 531 | + * | |
| 532 | + * Yatra Pro writes the Email Logs, but only from its own modules — | |
| 533 | + * nothing records what core sends, so a booking confirmation or a | |
| 534 | + * review request left no trace and an operator looking for "which | |
| 535 | + * email went to this customer" found a log that quietly covered | |
| 536 | + * only part of the picture. Pro listens for this and logs it. | |
| 537 | + * | |
| 538 | + * @param string $type Template type, e.g. review_request. | |
| 539 | + * @param string $to Recipient address. | |
| 540 | + * @param string $subject Rendered subject. | |
| 541 | + * @param string $body Rendered body. | |
| 542 | + * @param bool $sent Whether wp_mail() accepted it. | |
| 543 | + * @param array<string, mixed> $variables Merge variables used to render. | |
| 544 | + */ | |
| 545 | + do_action('yatra_transactional_email_sent', $type, $to, $rendered['subject'], $rendered['body'], $sent, $variables); | |
| 546 | + | |
| 547 | + return $sent; | |
| 528 | 548 | } finally { |
| 529 | 549 | self::$dispatchingType = $previousType; |
| 530 | 550 | } |
| 531 | 551 | } |