Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
1 / 1
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2
3declare(strict_types=1);
4
5/** @license For full copyright and license information, please see the LICENSE.md file. */
6
7namespace App\Modules\Mail\Application\Service;
8
9defined('AMMONLY_APP') || exit('Direct script access is forbidden.');
10
11/**
12 * Interface for System Transactional Email Delivery Service.
13 *
14 * Dispatches automated transactional emails (password reset, security alerts, MFA notifications)
15 * from the dedicated system@ammonly.com mailbox with multi-language template resolution.
16 *
17 * @package App\Modules\Mail\Application\Service
18 */
19interface SystemMailSenderServiceInterface
20{
21    /**
22     * Sends transactional email based on localized database template.
23     *
24     * Resolves matching template for given code and recipient locale (PL/EN),
25     * replaces placeholders, and transmits via system@ammonly.com SMTP mailbox.
26     *
27     * @param string $recipientEmail Target email address.
28     * @param string $recipientName Target recipient full name.
29     * @param string $templateCode Template code (e.g. PASSWORD_RESET, MFA_SECURITY_ALERT).
30     * @param array<string, scalar> $variables Context variables for template substitution.
31     * @param string $locale Preferred recipient locale ('pl', 'en').
32     * @return bool True on successful transmission.
33     */
34    public function sendTemplateEmail(
35        string $recipientEmail,
36        string $recipientName,
37        string $templateCode,
38        array $variables,
39        string $locale = 'pl'
40    ): bool;
41
42    /**
43     * Sends raw transactional HTML/Text email directly from system mailbox.
44     *
45     * @param string $recipientEmail Target email address.
46     * @param string $recipientName Target recipient full name.
47     * @param string $subject Message subject.
48     * @param string $htmlBody HTML body content.
49     * @param string|null $textBody Optional plain text body.
50     * @return bool True on successful transmission.
51     */
52    public function sendRawEmail(
53        string $recipientEmail,
54        string $recipientName,
55        string $subject,
56        string $htmlBody,
57        ?string $textBody = null
58    ): bool;
59}