-
Notifications
You must be signed in to change notification settings - Fork 2
/
MailerInterface.php
45 lines (41 loc) · 1.9 KB
/
MailerInterface.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
<?php
namespace bashkarev\swiftmailer;
/**
* MailerInterface is the interface that should be implemented by mailer classes.
* @author Dmitriy Bashkarev <[email protected]>
* @author Paul Klimov <[email protected]>
*/
interface MailerInterface
{
/**
* Creates a new message instance and optionally composes its body content via view rendering.
*
* @param string|array|null $view the view to be used for rendering the message body. This can be:
*
* - a string, which represents the view name or path alias for rendering the HTML body of the email.
* In this case, the text body will be generated by applying `strip_tags()` to the HTML body.
* - an array with 'html' and/or 'text' elements. The 'html' element refers to the view name or path alias
* for rendering the HTML body, while 'text' element is for rendering the text body. For example,
* `['html' => 'contact-html', 'text' => 'contact-text']`.
* - null, meaning the message instance will be returned without body content.
*
* @param array $params the parameters (name-value pairs) that will be extracted and made available in the view file.
* @return MessageInterface message instance.
*/
public function compose($view = null, array $params = []);
/**
* Sends the given email message.
* @param MessageInterface $message email message instance to be sent
* @return boolean whether the message has been sent successfully
*/
public function send($message);
/**
* Sends multiple messages at once.
*
* This method may be implemented by some mailers which support more efficient way of sending multiple messages in the same batch.
*
* @param array $messages list of email messages, which should be sent.
* @return integer number of messages that are successfully sent.
*/
public function sendMultiple(array $messages);
}