-
Notifications
You must be signed in to change notification settings - Fork 0
/
Mailer.php
91 lines (81 loc) · 2.74 KB
/
Mailer.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php
/**
* Qubus\Mail
*
* @link https://github.com/QubusPHP/mail
* @copyright 2023
* @author Joshua Parker <[email protected]>
* @license https://opensource.org/licenses/mit-license.php MIT License
*/
declare(strict_types=1);
namespace Qubus\Mail;
use PHPMailer\PHPMailer\PHPMailer;
use Qubus\Exception\Exception;
interface Mailer extends Headers, Addresses, Transport
{
/**
* Sets message type to HTML or plaintext.
*
* @param bool $isHtml True for HTML mode.
* @return static
*/
public function withHtml(bool $isHtml = false): static;
/**
* Add an attachment from a path on the filesystem.
*
* @param string $path Path to the attachment
* @param string $name Overrides the attachment name
* @param string $encode File encoding (see $Encoding)
* @param string $type MIME type, e.g. `image/jpeg`; determined automatically from $path if not specified
* @param string $disposition Disposition to use.
* @return static
* @throws \PHPMailer\PHPMailer\Exception
*/
public function withAttachment(
string $path,
string $name = '',
string $encode = PHPMailer::ENCODING_BASE64,
string $type = '',
string $disposition = 'attachment'
): static;
/**
* Set Mail Body configuration
*
* Format email message Body, this can be an external template html file with a copy
* of a plain-text like template.txt or HTML/plain-text string.
*
* This method can be used by passing a template file HTML name and an associative array
* with the values that can be parsed into the file HTML by the key KEY_NAME found in your
* array to your HTML {{KEY_NAME}}.
*
* Other optional ways to format the mail body is available like instead of a template the
* param $data can be set as an array or string, but param $options['template_name'] must be equal to null.
*
* @param array|string $data Contain the values to be parsed in mail body.
* @param array $options Array of options.
* @return static
*/
public function withBody(string|array $data, array $options = []): static;
/**
* The plain-text message body.
*
* @param string $message
* @return static
*/
public function withAltBody(string $message = ''): static;
/**
* Save message as eml file.
*
* @return bool True if saved successfully, false otherwise.
* @throws Exception
*/
public function save(): bool;
/**
* Create a message and send it.
* Uses the sending method specified by $Mailer.
*
* @return bool false on error.
* @throws \PHPMailer\PHPMailer\Exception|Exception
*/
public function send(): bool;
}