/** * testing method to check if sendMail is correct. */ public function testSendMail() { $to = "*****@*****.**"; $subject = "test send mail from unit test"; $body = "Have a nice day!"; $this->assertTrue(CommonMailer::sendMail($to, $subject, $body)); }
/** * testing method to check if sendMail is correct. */ public function testSendMail() { $to = "*****@*****.**"; $subject = "test send mail from unit test"; $body = "Have a nice day!"; $this->assertTrue(CommonMailer::sendMail($to, $subject, $body)); }
/** * send a email to recover the password * @param type $user * @return true if it s sent ( stored in db then pull by the cron task) */ public static function sendMailRecoverPassword($user) { try { if ($user != null) { $to = $user->email; } $fname = ucfirst($user->prenom); $lname = strtoupper($user->nom); $login = $user->login; $password = $user->password; $subject = "Informations perdues sur cbsdplatform.fr"; $body = "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd\">\n <?xml version=\"1.0\" encoding=\"utf-8\"?>\n <html><head>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"> <title>Vos exports sur cbsdplatform.fr</title>\n </head><body>\n Cher (Chère) {$fname} {$lname},<br><br>\n Suite à votre demande effectuée sur le site cbsdplatform, nous vous rappelons vos codes d'accès :<br>\n Identifiant : {$login}<br>\n Password : {$password} <br>\n Vous pouvez dès à présent vous connecter sur <a href=\"" . Yii::app()->getBaseUrl(true) . "\">cbsdplatform</a> avec ces identifiants.<br>\nA bientôt sur cbsdplatform.\n </body>\n "; return CommonMailer::sendMail($to, $subject, $body); } catch (Exception $e) { Yii::log("exception sur save mail", "error"); return false; } }