コード例 #1
0
 public function indexAction()
 {
     $this->view->Title = 'Contact form';
     $this->view->headTitle($this->view->Title);
     $captcha = new My_Plugin_Image();
     $this->view->captcha = $captcha->render($this->view);
     $this->view->captcha_id = $captcha->getId();
     if ($this->getRequest()->isPost()) {
         $request = $this->getRequest()->getParams();
         $error = $this->_checkForm($request);
         if (count($error) == 0) {
             $Contact = new Contact();
             $Contact->merge($request);
             $Contact->save();
             /**
              * Check server mail valid
              * @var unknown_type
              */
             $check_mail_server = array('username' => Zend_Registry::get('Setting')->EMAIL_SMTP_USER, 'password' => Zend_Registry::get('Setting')->EMAIL_SMTP_PASS, 'port' => Zend_Registry::get('Setting')->EMAIL_SMTP_PORT);
             if (!$check_mail_server['username'] || !$check_mail_server['password'] || !$check_mail_server['port']) {
                 /**
                  * Not send mail to admin
                  */
                 My_Plugin_Libs::setSplash('<b>Your feedback have been send to us. Thank you very much!</b>');
                 $this->_redirect($this->_helper->url('index', 'contact', 'default'));
             } else {
                 /**
                  * Send mail to admin
                  */
                 if ($request['contact_type'] == "Contact") {
                     $subject = "[" . Zend_Registry::get('Setting')->DOMAIN . "][Contact] From : " . $request['contact_first_name'] . " " . $request['contact_last_name'];
                 } else {
                     $subject = "[" . Zend_Registry::get('Setting')->DOMAIN . "][Get listed] - From: " . $request['contact_first_name'] . " " . $request['contact_last_name'];
                 }
                 $email = Zend_Registry::get('Setting')->webmaster_email;
                 $name = "Administrator";
                 $message = $request['message'];
                 $sendmail = new My_Plugin_Email();
                 $sendmail->send($subject, $email, $name, $message, $type = 'html');
                 My_Plugin_Libs::setSplash('<b>Your feedback have been send to us. Thank you very much!</b>');
                 $this->_redirect($this->_helper->url('index', 'contact', 'default'));
             }
         }
         if (count($error)) {
             $this->view->error = $error;
         }
     }
     $this->view->Contact = $Contact;
 }
コード例 #2
0
ファイル: Email.php プロジェクト: hoaitn/base-zend
 /**
  * Gửi Email xác nhận yêu cầu Cancel của khách hàng
  * @param $email
  * @param $name
  * @param $Booking
  */
 public static function sendBookingCancel($email, $name, $Booking)
 {
     $layout = self::generateLayout();
     $view = self::generateView();
     $view->assign('Booking', $Booking);
     $layout->content = $view->render('amen_cancel_request.phtml');
     $oEmail = new My_Plugin_Email();
     $oEmail->send('Cancel Request for Booking ID ' . $Booking->getBookingId() . ' at ' . $Booking->getHotel() . ', ' . $Booking->getHotelCity(), $email, $name, $layout->render());
 }
コード例 #3
0
ファイル: MemberController.php プロジェクト: hoaitn/base-zend
 public function loginforgotAction()
 {
     $this->view->Title = "For gotten password";
     $this->view->headTitle($this->view->Title);
     $error = '';
     $id = 7;
     $Content = Content::getById($id);
     if ($this->getRequest()->isPost()) {
         $Request = $this->getRequest()->getParams();
         $Member = Members::getByEmail($Request['email']);
         if ($Member) {
             $String = My_Plugin_Libs::randomStr();
             $Member->encodePassword($String);
             $Member->save();
             $message = str_replace(array('%email%', '%password%'), array($Member->email, $String), $Content['content']);
             $to = $Member->email;
             $subject = $Content->title;
             $oEmail = new My_Plugin_Email();
             $oEmail->send($subject, $to, '', $message);
             $error = 'Password has been sent to your email!';
         } else {
             $error = 'Email is not macth please try again!';
         }
     }
 }