function checkemailAction() { $email = $this->_getParam('email'); $tbluser = new Kutu_Core_Orm_Table_User(); $where = $tbluser->getAdapter()->quoteInto("email=?", $email); $rowset = $tbluser->fetchRow($where); if ($rowset) { echo 'false'; } else { echo 'true'; } die; }
/** * _writeConfirmCorporateEmail * @return JSON */ function _writeConfirmCorporateEmail($mailcontent, $fullname, $company, $payment, $disc, $total, $username, $guid, $email) { $obj = new Kutu_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 Kutu_Core_Orm_Table_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> </td><td> </td><td><b>Password</b></td></tr>'; foreach ($rowUser as $rowsetUser) { $tag .= '<tr><td>' . $rowsetUser->username . '</td><td> </td><td> </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(KUTU_ROOT_DIR . '/application/configs/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) { $message = "Please check your email at {$email}!"; // update user $rowUser = $tblUser->find($obj->decryptPassword($guid))->current(); if ($rowUser) { $rowUser->isEmailSent = 'Y'; $rowUser->save(); } } else { $message = "Error send mail but register user successfully!<br>Please contact our customer service for more information"; } } else { $message = "Error saving mail!"; } return $message; }
function _writeConfirmCorporateEmail($mailcontent, $company, $payment, $disc, $total, $username, $guid, $email) { $formater = new Kutu_Lib_Formater(); $obj = new Kutu_Crypt_Password(); $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 Kutu_Core_Orm_Table_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> </td><td> </td><td><b>Password</b></td></tr>'; foreach ($rowUser as $rowsetUser) { $tag .= '<tr><td>' . $rowsetUser->username . '</td><td> </td><td> </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(KUTU_ROOT_DIR . '/app/config/config.ini', 'mail'); $mailAttempt = $formater->add_mail($config->from, $email, $username, 'Hukumonline-ID', $mail_body); // try to save mail before send if ($mailAttempt) { $sendAttempt = $formater->send_mail(); if ($sendAttempt) { $response['success'] = true; $response['message'] = "Please check your email at {$email}!"; } else { ob_clean(); $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); }