From 3cd6ab58891285a6b645c17c1ba6a30fd0b72834 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Sun, 31 Jul 2016 14:08:51 +0200 Subject: [PATCH] Convert EmailNewActivationCodeForm to new email API --- .../form/EmailNewActivationCodeForm.class.php | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/wcfsetup/install/files/lib/form/EmailNewActivationCodeForm.class.php b/wcfsetup/install/files/lib/form/EmailNewActivationCodeForm.class.php index 19ff112aeb..06cc47dfa7 100644 --- a/wcfsetup/install/files/lib/form/EmailNewActivationCodeForm.class.php +++ b/wcfsetup/install/files/lib/form/EmailNewActivationCodeForm.class.php @@ -2,8 +2,11 @@ namespace wcf\form; use wcf\data\user\User; use wcf\data\user\UserAction; +use wcf\system\email\mime\MimePartFacade; +use wcf\system\email\mime\RecipientAwareTextMimePart; +use wcf\system\email\Email; +use wcf\system\email\UserMailbox; use wcf\system\exception\UserInputException; -use wcf\system\mail\Mail; use wcf\system\request\LinkHandler; use wcf\system\WCF; use wcf\util\HeaderUtil; @@ -64,14 +67,19 @@ class EmailNewActivationCodeForm extends RegisterNewActivationCodeForm { ]); $this->objectAction->executeAction(); + // reload user object + $this->user = new User($this->user->userID); + // send activation mail - $messageData = [ - 'username' => $this->user->username, - 'userID' => $this->user->userID, - 'activationCode' => $activationCode - ]; - $mail = new Mail([$this->user->username => $this->user->newEmail], WCF::getLanguage()->getDynamicVariable('wcf.user.changeEmail.needReactivation.mail.subject'), WCF::getLanguage()->getDynamicVariable('wcf.user.changeEmail.needReactivation.mail', $messageData)); - $mail->send(); + $email = new Email(); + $email->addRecipient(new UserMailbox($this->user)); + $email->setSubject($this->user->getLanguage()->getDynamicVariable('wcf.user.changeEmail.needReactivation.mail.subject')); + $email->setBody(new MimePartFacade([ + new RecipientAwareTextMimePart('text/html', 'email_changeEmailNeedReactivation'), + new RecipientAwareTextMimePart('text/plain', 'email_changeEmailNeedReactivation') + ])); + $email->send(); + $this->saved(); // forward to index page -- 2.20.1