public static function sendActivation(sfEvent $event) { $controller = $event->getSubject(); $user = $controller->user; // already activated if ($user->getIsActive()) { return; } // save password to send in register email $controller->getUser()->setAttribute('user_password', $event['password'], 'doPreUser'); $activation = new UserActivationCode(); $activation->setUserId($user->getId()); $activation->setCode(doAuthTools::activationCode($user)); $activation->save(); $subject = sfConfig::get('sf_i18n') ? $controller->getContext()->getI18N()->__('Your activation code') : 'Your activation code'; // message should be sent immediately $controller->getMailer()->composeAndSend(sfConfig::get('app_doAuth_email_from', 'mailer@' . $controller->getRequest()->getHost()), array($user->getEmail() => $user->getUsername()), $subject, $controller->getPartial(sfConfig::get('app_doAuth_email_module', $controller->getModuleName()) . '/mail_activation', array('code' => $activation->getCode())), 'text/plain'); }