public function contact() { $this->set('title_for_layout', 'Contact Us'); $this->loadModel('EmailContent'); $data = $this->request->data; //prd($data); if ($this->request->is('post')) { if (isset($data) && !empty($data)) { $name = $data['PageContact']['name']; $email = $data['PageContact']['email']; $msg = $data['PageContact']['message']; $subject = $data['PageContact']['subject']; $emailObj = new EmailContent(); $response = $emailObj->contactUsMail($name, $email, $msg, $subject); if ($response) { $this->flash_msg('Thanks for contacting us. We will be in touch with you soon.', 1); $this->redirect(array('controller' => 'pages', 'action' => 'contact')); } else { $this->flash_msg('There is some error. Please try again', 2); $this->redirect(array('controller' => 'pages', 'action' => 'contact')); } } } }
<?php /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ require './EmailContent.php'; require './SendingEmail.php'; $iniConfiguration = parse_ini_file("../../model-db-connection/configuration.ini"); $contactName = (string) filter_input(INPUT_GET, 'contactName'); $contactEmail = (string) filter_input(INPUT_GET, 'contactEmail'); $contactSubject = (string) filter_input(INPUT_GET, 'contactSubject'); $contactMessage = (string) filter_input(INPUT_GET, 'contactMessage'); $emailContent = new EmailContent(); $emailBody = $emailContent->getEmailContentContact($contactName, $contactSubject, $contactMessage); $sendingEmail = new SendingEmail($iniConfiguration['email.host'], $iniConfiguration['email.username'], $iniConfiguration['email.password'], $iniConfiguration['email.official'], "Email Contact: " . $contactSubject, $emailBody, $contactEmail, $contactName); echo $sendingEmail->sendingEmail();
if ($updateResult == 200) { //Sending email to customer $emailContent = new EmailContent(); $emailBody = $emailContent->getForgetPasswordTemplate($cusUsername, $cusEmail, $iniConfiguration['guest.password.default'], $iniConfiguration['web.application.prefix'], $cusName); $sendingEmail = new SendingEmail($iniConfiguration['email.host'], $iniConfiguration['email.username'], $iniConfiguration['email.password'], $cusEmail, $iniConfiguration['email.subject.customer.forget.password'], $emailBody, $iniConfiguration['email.username'], $iniConfiguration['email.name']); echo $sendingEmail->sendingEmail(); } else { echo $updateResult; } } else { if ($customerService->getCustomerByUsername($emailOrUsernam) != 404) { $jsonObj = $customerService->getCustomerByUsername($emailOrUsernam); $obj = json_decode($jsonObj); $cusUsername = $obj->{'CUS_USERNAME'}; $cusEmail = $obj->{'CUS_EMAIL'}; $cusName = $obj->{'CUS_FIRST_NAME'} . " " . $obj->{'CUS_LAST_NAME'}; //Start update password $updateResult = $customerService->resetPassword(md5($iniConfiguration['guest.password.default']), $obj->{'CUS_ID'}); if ($updateResult == 200) { //Sending email to customer $emailContent = new EmailContent(); $emailBody = $emailContent->getForgetPasswordTemplate($cusUsername, $cusEmail, $iniConfiguration['guest.password.default'], $iniConfiguration['web.application.prefix'], $cusName); $sendingEmail = new SendingEmail($iniConfiguration['email.host'], $iniConfiguration['email.username'], $iniConfiguration['email.password'], $cusEmail, $iniConfiguration['email.subject.customer.forget.password'], $emailBody, $iniConfiguration['email.username'], $iniConfiguration['email.name']); echo $sendingEmail->sendingEmail(); } else { echo $updateResult; } } else { echo 'ชื่อผู้ใช้(Username) หรือ อีเมล(Email) ไม่ถูกต้อง'; } }
$customerVO->setCusLastName($lName); $customerVO->setCusGender($gender); $customerVO->setCusContactAddr($address); $customerVO->setPhoneNumber($phone); $customerVO->setCusFacebookAddr($facebookAdr); $customerVO->setForceChange("false"); if ($customerService->duplicationUsername($username) && $customerService->duplicationEmail($email)) { echo "Your username and email have been used"; } else { if ($customerService->duplicationUsername($username)) { echo "This username have been used"; } else { if ($customerService->duplicationEmail($email)) { echo "This email have been used"; } else { $saveResult = $customerService->saveCustomer($customerVO); if ($saveResult == 200) { if ($iniConfiguration['email.sending.to.customer'] == true) { $emailContent = new EmailContent(); $emailBody = $emailContent->getCusRegisterNormalContent($iniConfiguration['web.application.prefix']); $sendingEmail = new SendingEmail($iniConfiguration['email.host'], $iniConfiguration['email.username'], $iniConfiguration['email.password'], $email, $iniConfiguration['email.subject.customer.register.prefix'], $emailBody, $iniConfiguration['email.username'], $iniConfiguration['email.name']); echo $sendingEmail->sendingEmail(); } else { echo $saveResult; } } else { echo $saveResult; } } } }
$sendingEmail->sendingEmail(); } //Sending enrollment email to official if ($iniConfiguration['email.sending.to.official'] == true) { $sqlGetCourseDetailByCourseID = "SELECT * FROM GTRICH_COURSE_HEADER HEADER " . "LEFT JOIN GTRICH_COURSE_CATEGORY CATE ON HEADER.REF_CATE_ID = CATE.CATE_ID " . "LEFT JOIN GTRICH_COURSE_EVENT_DATE_TIME EDATE ON HEADER.HEADER_ID = EDATE.REF_COURSE_HEADER_ID " . "WHERE HEADER.HEADER_ID = '" . $courseID . "' " . "AND EDATE.EVENT_ID = '" . $eventDateTime . "'"; $resReport = mysql_query($sqlGetCourseDetailByCourseID); $rowReport = mysql_fetch_assoc($resReport); $courseName = $rowReport['HEADER_NAME']; $firstDateTime = explode(" ", $rowReport['START_EVENT_DATE_TIME']); $startDate = $firstDateTime[0]; $startTime = $firstDateTime[1]; $secondDateTime = explode(" ", $rowReport['END_EVENT_DATE_TIME']); $endDate = $secondDateTime[0]; $endTime = $secondDateTime[1]; $courseDate = '<span>เริ่ม วันที่ ' . $startDate . ' เวลา ' . $startTime . 'น. ถึง วันที่ ' . $endDate . ' เวลา ' . $endTime . 'น.</span>'; $emailContent = new EmailContent(); $emailBody = $emailContent->getOfficialEmailEnrollment($fName . " " . $lName, $email, $phone, $rowGetMore['CONTACT_ADDR'], $rowGetMore['RECEIPT_ADDR'], $courseName, $courseDate, $iniConfiguration['web.application.prefix']); $sendingEmail = new SendingEmail($iniConfiguration['email.host'], $iniConfiguration['email.username'], $iniConfiguration['email.password'], $iniConfiguration['email.official'], $iniConfiguration['email.subject.official.prefix'], $emailBody, $iniConfiguration['email.username'], $iniConfiguration['email.name']); $sendingEmail->sendingEmail(); } } else { echo $resultFromCheckCust; } } else { echo $saveResult; } } } //Delete temp table $sqlDropTmpTable = "DROP TABLE TMP_REGISTER_" . $_SESSION['MORE_TEMP_REGIST']; $dropResult = mysql_query($sqlDropTmpTable);