/** * _writeConfirmCorporateEmail * @return JSON */ function _writeConfirmCorporateEmail($mailcontent, $fullname, $company, $payment, $disc, $total, $username, $guid, $email) { $obj = new Pandamp_Crypt_Password(); $mailcontent = str_replace('$fullname', $fullname, $mailcontent); $mailcontent = str_replace('$company', $company, $mailcontent); $mailcontent = str_replace('$timeline', $payment, $mailcontent); $mailcontent = str_replace('$disc', $disc, $mailcontent); $mailcontent = str_replace('$price', number_format($total), $mailcontent); $mailcontent = str_replace('$username1', $username, $mailcontent); $mailcontent = str_replace('$guid', $guid, $mailcontent); // table User $tblUser = new Pandamp_Modules_Identity_User_Model_User(); $where = $tblUser->getAdapter()->quoteInto('company=?', $company); $rowUser = $tblUser->fetchAll($where, 'username ASC'); $tag = '<table>'; $tag .= '<tr><td><b>Username</b></td><td> </td><td><b>Password</b></td></tr>'; foreach ($rowUser as $rowsetUser) { $tag .= '<tr><td>' . $rowsetUser->username . '</td><td> </td><td>' . $obj->decryptPassword($rowsetUser->password) . '</td></tr>'; } $tag .= '</table>'; $mailcontent = str_replace('$tag', $tag, $mailcontent); $mail_body = $mailcontent; // parse ini_file $config = new Zend_Config_Ini(CONFIG_PATH . '/mail.ini', 'mail'); $mailAttempt = $this->add_mail($config->mail->sender->support->email, $email, $username, $config->mail->sender->support->name, $mail_body); // try to save mail before send if ($mailAttempt) { $sendAttempt = $this->send_mail(); if ($sendAttempt) { $response['success'] = true; $response['message'] = "Please check your email at {$email}!"; // update user $rowUser = $tblUser->find($obj->decryptPassword($guid))->current(); if ($rowUser) { $rowUser->isEmailSent = 'Y'; $rowUser->save(); } } else { $response['failure'] = false; $response['message'] = "Error send mail but register user successfully!<br>Please contact our customer service for more information"; } } else { $response['failure'] = true; $response['message'] = "Error saving mail!"; } echo Zend_Json::encode($response); }
function checkemailAction() { $email = $this->_getParam('email'); $tbluser = new Pandamp_Modules_Identity_User_Model_User(); $where = $tbluser->getAdapter()->quoteInto("email=?", $email); $rowset = $tbluser->fetchRow($where); if ($rowset) { echo 'false'; } else { echo 'true'; } die; }