/** * Send an activation email to a new user telling them how to activate * their account. * * @param User $user * @return boolean True if the email was successfully sent, false otherwise. */ protected function sendActivationEmail($user) { $ua = $this->_helper->db->getTable('UsersActivations')->findByUser($user); if ($ua) { $ua->delete(); } $ua = new UsersActivations(); $ua->user_id = $user->id; $ua->save(); // send the user an email telling them about their new user account $siteTitle = get_option('site_title'); $from = get_option('administrator_email'); $body = __('Welcome!') . "\n\n" . __('Your account for the %s repository has been created. Please click the following link to activate your account:', $siteTitle) . "\n\n" . WEB_ROOT . "/admin/users/activate?u={$ua->url}\n\n" . __('%s Administrator', $siteTitle); $subject = __('Activate your account with the %s repository', $siteTitle); $mail = new Zend_Mail('UTF-8'); $mail->setBodyText($body); $mail->setFrom('*****@*****.**', "Archives départementales 35"); $mail->addTo($user->email, $user->name); $mail->setSubject($subject); $mail->addHeader('X-Mailer', 'PHP/' . phpversion()); try { $mail->send(); return true; } catch (Zend_Mail_Transport_Exception $e) { $logger = $this->getInvokeArg('bootstrap')->getResource('Logger'); if ($logger) { $logger->log($e, Zend_Log::ERR); } return false; } }