Use new email API in RegisterNewActivationCodeForm
authorTim Düsterhus <duesterhus@woltlab.com>
Sun, 5 Jun 2016 19:55:23 +0000 (21:55 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Thu, 28 Jul 2016 20:06:18 +0000 (22:06 +0200)
wcfsetup/install/files/lib/form/RegisterNewActivationCodeForm.class.php

index 020060a0ea64494595dba193b4c9c10462fb18a9..d2e3bd9d0c5d7bf119e6f3306671210597fffa10 100644 (file)
@@ -4,7 +4,10 @@ use wcf\data\user\User;
 use wcf\data\user\UserAction;
 use wcf\system\exception\IllegalLinkException;
 use wcf\system\exception\UserInputException;
-use wcf\system\mail\Mail;
+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\request\LinkHandler;
 use wcf\system\WCF;
 use wcf\util\HeaderUtil;
@@ -147,8 +150,14 @@ class RegisterNewActivationCodeForm extends AbstractForm {
                $this->user = new User($this->user->userID);
                
                // send activation mail
-               $mail = new Mail([$this->user->username => (!empty($this->email) ? $this->email : $this->user->email)], WCF::getLanguage()->getDynamicVariable('wcf.user.register.needActivation.mail.subject'), WCF::getLanguage()->getDynamicVariable('wcf.user.register.needActivation.mail', ['user' => $this->user]));
-               $mail->send();
+               $email = new Email();
+               $email->addRecipient(new UserMailbox($this->user));
+               $email->setSubject(WCF::getLanguage()->getDynamicVariable('wcf.user.register.needActivation.mail.subject'));
+               $email->setBody(new MimePartFacade([
+                       new RecipientAwareTextMimePart('text/html', 'email_registerNeedActivation'),
+                       new RecipientAwareTextMimePart('text/plain', 'email_registerNeedActivation')
+               ]));
+               $email->send();
                $this->saved();
                
                // forward to index page