92 $email->setFrom(self::prepareFrom($from));
101 if (isset(
$params[
'attachments']) && is_array(
$params[
'attachments'])) {
102 foreach (
$params[
'attachments'] as $attachment) {
103 $email->addAttachment($attachment);
118 $this->sender = $sender;
128 return $this->sender;
160 $this->to = $this->prepareRecipients(
$recipient);
181 $this->cc = $this->prepareRecipients(
$recipient);
202 $this->bcc = $this->prepareRecipients(
$recipient);
325 if ($attachment instanceof Part) {
326 $this->attachments[] = $attachment;
330 if ($attachment instanceof \
ElggFile) {
331 $this->attachments[] = Attachment::fromElggFile($attachment);
335 $attachment = Attachment::factory($attachment);
336 if (!empty($attachment)) {
337 $this->attachments[] = $attachment;
363 if ($add_microtime) {
370 return "{$urlPath}.entity.{$entity->guid}{$microtime}@{$hostname}";
389 $from =
new Address($from->getEmailAddress(), $from->getDisplayName());
392 if (!$from instanceof \
ElggUser && $from->email) {
393 $from = Address::fromEntity($from);
397 $from_display =
elgg_echo(
'notification:method:email:from', [$from->getDisplayName(),
$site->getDisplayName()]);
398 $from =
new Address(
$site->getEmailAddress(), $from_display);
400 }
elseif (is_string($from)) {
401 $from = Address::fromString($from);
404 if (!$from instanceof
Address) {
421 if (empty($recipients)) {
425 if (!is_array($recipients)) {
426 $recipients = [$recipients];
431 if ($recipient instanceof
Address) {
437 $recipient = Address::fromEntity($recipient);
438 }
elseif (is_string($recipient)) {
439 $recipient = Address::fromString($recipient);
442 if (!$recipient instanceof Address) {
setFrom(Address $from)
Sets sender address.
setCc($recipient)
Sets recipient address in cc.
getTo()
Returns recipient address.
Exception thrown if an argument is not of the expected type.
$params
Saves global plugin settings.
if(!$user||!$user->canDelete()) $name
prepareRecipients($recipients)
Converts mixed input to an array of Laminas address instances.
setParams(array $params=[])
Sets additional params.
setSender($sender)
Sets email sender.
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
static prepareFrom($from)
Converts mixed input to an instance of Laminas addres.
getParams()
Returns additional params.
setHeaders(array $headers=[])
Replaces header bag.
getBcc()
Returns recipient address from bcc.
static factory(array $options=[])
Create an email instance form an array of options.
setSubject($subject= '')
Sets email subject.
setBcc($recipient)
Sets recipient address in bcc.
setBody($body= '')
Sets the email message body.
if($item instanceof\ElggEntity) elseif($item instanceof\ElggRiverItem) elseif($item instanceof\ElggRelationship) elseif(is_callable([$item, 'getType']))
elgg_extract($key, $array, $default=null, bool $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
if($who_can_change_language=== 'nobody') elseif($who_can_change_language=== 'admin_only'&&!elgg_is_admin_logged_in()) $options
getCc()
Returns recipient address from cc.
getSubject()
Returns the subject.
addAttachment($attachment)
Add an attachment.
getSender()
Returns sender.
elgg_get_site_url()
Get the URL for the current (or specified) site, ending with "/".
elgg_get_site_entity()
Get the current site entity.
getBody()
Returns email body.
elgg_substr()
Wrapper function for mb_substr().
$attachments
Outputs attachments.
setTo($recipient)
Sets recipient address.
getHeaders()
Returns headers.
createEntityMessageID(\ElggEntity $entity, bool $add_microtime=false)
Create a Message-ID header string for the given entity.
_elgg_services()
Get the global service provider.
getFrom()
Returns sender address.
addHeader($name, $value)
Adds/replaces an HTTP/IMF header.
getAttachments()
Get all attachments.