Commit 6372aefa authored by Ben Hayward's avatar Ben Hayward

Added in reply-to properties

1 merge request!345WIP: [Sprint/OldfashionedOwl](fix): Updated from address in ban email to info@minds.com
Pipeline #89877956 canceled with stages
in 16 seconds
......@@ -53,9 +53,12 @@ class Mailer
$this->mailer->ClearAllRecipients();
$this->mailer->ClearAttachments();
if (isset($message->from['email'])) {
if (isset($message->getReplyTo()['email'])) {
$this->mailer->ClearReplyTos();
$this->mailer->addReplyTo($message->from['email'], $fromName);
$this->mailer->addReplyTo(
$message->getReplyTo()['email'],
$message->getReplyTo()['name']
);
}
$this->mailer->setFrom($message->from['email'], $fromName);
......
......@@ -13,6 +13,7 @@ class Message
use MagicAttributes;
public $from = [];
public $to = [];
public $replyTo = [];
public $subject = '';
public $html = '';
public $messageId = '';
......@@ -112,4 +113,28 @@ class Message
{
return $this->html->render();
}
/**
* Get reply-to.
*
* @return Message returns array containing email and username.
*/
public function getReplyTo(): array
{
return $this->replyTo;
}
/**
* Set reply-to.
*
* @param string $email - the email address for the reply.
* @param string $name - the name to be replied to.
*
* @return Message returns $this instance for chaining.
*/
public function setReplyTo($email, $name = 'Minds'): Message
{
$this->replyTo['email'] = $email;
$this->replyTo['username'] = $name;
return $this;
}
}
......@@ -32,7 +32,7 @@ class Events
$message->setTo($user)
->setMessageId(implode('-', [$user->guid, sha1($user->getEmail()), sha1('register-' . time())]))
->setSubject("You are banned from Minds.")
->setFrom($config->get('contact_details')['email'], $config->get('contact_details')['name'])
->setReplyTo($config->get('contact_details')['email'], $config->get('contact_details')['name'])
->setHtml($template);
Di::_()->get('Mailer')->queue($message);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment