Commit 6372aefa authored by Ben's avatar Ben
Browse files

Added in reply-to properties

parent ea80c2fa
Loading
Loading
Loading
Loading
+5 −2
Original line number Original line Diff line number Diff line
@@ -53,9 +53,12 @@ class Mailer
        $this->mailer->ClearAllRecipients();
        $this->mailer->ClearAllRecipients();
        $this->mailer->ClearAttachments();
        $this->mailer->ClearAttachments();


        if (isset($message->from['email'])) {
        if (isset($message->getReplyTo()['email'])) {
            $this->mailer->ClearReplyTos();
            $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);
        $this->mailer->setFrom($message->from['email'], $fromName);
+25 −0
Original line number Original line Diff line number Diff line
@@ -13,6 +13,7 @@ class Message
    use MagicAttributes;
    use MagicAttributes;
    public $from = [];
    public $from = [];
    public $to = [];
    public $to = [];
    public $replyTo = [];
    public $subject = '';
    public $subject = '';
    public $html = '';
    public $html = '';
    public $messageId = '';
    public $messageId = '';
@@ -112,4 +113,28 @@ class Message
    {
    {
        return $this->html->render();
        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;
    }
}
}
+1 −1
Original line number Original line Diff line number Diff line
@@ -32,7 +32,7 @@ class Events
            $message->setTo($user)
            $message->setTo($user)
                ->setMessageId(implode('-', [$user->guid, sha1($user->getEmail()), sha1('register-' . time())]))
                ->setMessageId(implode('-', [$user->guid, sha1($user->getEmail()), sha1('register-' . time())]))
                ->setSubject("You are banned from Minds.")
                ->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);
                ->setHtml($template);
            Di::_()->get('Mailer')->queue($message);
            Di::_()->get('Mailer')->queue($message);