/** * Send request change password email * * @author Stoyan Rangelov * @param \User\Entity\User $user */ public function sendRequestChangePasswordEmail(\User\Entity\User $user, $code) { $from = $this->getSenderEmail(); $to = $user->getLogin(); $subject = "Please change your password"; /*$htmlBody = "Hello <br /> Please change your password via the following link: <br /> <b>{$this->getChangePasswordURL()}/{$code}</b>";*/ $passwordUrl = "{$this->getChangePasswordURL()}/{$code}"; $htmlBody = $this->getChangePasswordEmailTemplate($passwordUrl); $textBody = ""; $htmlPart = new MimePart($htmlBody); $htmlPart->type = "text/html; charset=UTF-8"; $textPart = new MimePart($textBody); $textPart->type = "text/plain; charset=UTF-8"; $body = new MimeMessage(); $body->setParts(array($textPart, $htmlPart)); $message = new Mail\Message(); $message->setFrom($from)->addTo($to)->setSubject($subject); $message->setEncoding("UTF-8"); $message->setBody($body); $transport = new SmtpTransport(); if ($this->getDefaultConfig()['user_module']['using_gmail']) { $transport->setOptions($this->getSMTPOptions()); } $transport->send($message); }
/** * {@inheritDoc} */ public function getLogin() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getLogin', array()); return parent::getLogin(); }