/** * Send confirmation email * * @author Stoyan Rangelov * @param \User\Entity\User $user */ public function sendConfirmationEmail(\User\Entity\User $user) { $from = $this->getSenderEmail(); $to = $user->getLogin(); $subject = "Bitte aktivieren Sie lhren incoverage-Account"; //$htmlBody = "Hello <br /> Please activate your account via the following link: <br /> <b> {$this->getActivationURL()}/{$user->getId()}/{$user->getActivationCode()} </b>"; $activationUrl = "{$this->getActivationURL()}/{$user->getId()}/{$user->getActivationCode()}"; $htmlBody = $this->getConfirmationTemplate($to, $activationUrl); $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, 'Incoverage')->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 getActivationCode() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getActivationCode', array()); return parent::getActivationCode(); }