73 $email->setFrom(self::prepareFrom($from));
74 $email->setTo(self::prepareTo($to));
80 if (isset(
$params[
'attachments']) && is_array(
$params[
'attachments'])) {
81 foreach (
$params[
'attachments'] as $attachment) {
82 $email->addAttachment($attachment);
226 if ($attachment instanceof Part) {
227 $this->attachments[] = $attachment;
231 if ($attachment instanceof \
ElggFile) {
232 $this->attachments[] = Attachment::fromElggFile($attachment);
236 $attachment = Attachment::factory($attachment);
237 if (!empty($attachment)) {
238 $this->attachments[] = $attachment;
267 if (!$from instanceof
ElggUser && $from->email) {
268 $from =
new Address($from->email, $from->getDisplayName());
274 }
elseif (is_string($from)) {
275 $from = Address::fromString($from);
278 if (!$from instanceof
Address) {
294 $to =
new Address($to->email, $to->getDisplayName());
295 }
elseif (is_string($to)) {
296 $to = Address::fromString($to);
setFrom(Address $from)
Sets sender address.
getTo()
Returns recipient address.
if(!$user||!$user->canDelete()) $name
$params
Saves global plugin settings.
setParams(array $params=[])
Sets additional params.
static prepareFrom($from)
Converts mixed input to an instance of Zend addres.
getParams()
Returns additional params.
setHeaders(array $headers=[])
Replaces header bag.
static factory(array $options=[])
Create an email instance form an array of options.
setSubject($subject= '')
Sets email subject.
setBody($body= '')
Sets the email message body.
getSubject()
Returns the subject.
addAttachment($attachment)
Add an attachment.
setTo(Address $to)
Sets recipient address.
elgg_get_site_entity()
Get the current site entity.
if($item instanceof\ElggEntity) elseif($item instanceof\ElggRiverItem) elseif(is_callable([$item, 'getType']))
getBody()
Returns email body.
elgg_extract($key, $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
$attachments
Outputs attachments.
getHeaders()
Returns headers.
getFrom()
Returns sender address.
static prepareTo($to)
Converts mixed input to an instance of Zend addres.
addHeader($name, $value)
Adds/replaces an HTTP/IMF header.
getAttachments()
Get all attachments.