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