]> git.mxchange.org Git - friendica.git/blob - src/Object/EMail/IEmail.php
Merge pull request #8227 from annando/daemon-checks
[friendica.git] / src / Object / EMail / IEmail.php
1 <?php
2
3 namespace Friendica\Object\EMail;
4
5 use Friendica\Util\Emailer;
6 use JsonSerializable;
7
8 /**
9  * Interface for a single mail, which can be send through Emailer::send()
10  *
11  * @see Emailer::send()
12  */
13 interface IEmail extends JsonSerializable
14 {
15         /**
16          * Gets the senders name for this email
17          *
18          * @return string
19          */
20         function getFromName();
21
22         /**
23          * Gets the senders email address for this email
24          *
25          * @return string
26          */
27         function getFromAddress();
28
29         /**
30          * Gets the UID of the sender of this email
31          *
32          * @return int|null
33          */
34         function getRecipientUid();
35
36         /**
37          * Gets the reply-to address for this email
38          *
39          * @return string
40          */
41         function getReplyTo();
42
43         /**
44          * Gets the senders email address
45          *
46          * @return string
47          */
48         function getToAddress();
49
50         /**
51          * Gets the subject of this email
52          *
53          * @return string
54          */
55         function getSubject();
56
57         /**
58          * Gets the message body of this email (either html or plaintext)
59          *
60          * @param boolean $plain True, if returned as plaintext
61          *
62          * @return string
63          */
64         function getMessage(bool $plain = false);
65
66         /**
67          * Gets any additional mail header
68          *
69          * @return string
70          */
71         function getAdditionalMailHeader();
72
73         /**
74          * Returns the current email with a new recipient
75          *
76          * @param string $address The email of the recipient
77          * @param int    $uid   The (optional) UID of the recipient for further infos
78          *
79          * @return static
80          */
81         function withRecipient(string $address, int $uid);
82
83         /**
84          * @param string $plaintext a new plaintext message for this email
85          * @param string $html      a new html message for this email (optional)
86          *
87          * @return static
88          */
89         function withMessage(string $plaintext, string $html = null);
90
91         /**
92          * @return string
93          */
94         function __toString();
95 }