function index() { if (isset($_POST['submitButton'])) { $l_oContactMail = new SwiftMailer(); $l_oContactMail->subject = 'Contact request'; $l_oContactMail->name = $_POST['form_name']; $l_oContactMail->email = $_POST['form_email']; $l_oContactMail->message = $_POST['form_msg']; $l_sStatus = $l_oContactMail->validate(); if ($l_sStatus) { $this->view->errorMail = $l_sStatus; } else { $l_sStatus = $l_oContactMail->contact(); if ($l_sStatus) { $this->view->errorMail = 'We appologise, but we were unable to connect to our mail server. Please contact us directly at info@artaddict.eu'; } else { $this->view->successMail = 'Your message has been submitted'; } } if (!empty($_POST['form_name']) && $l_sStatus) { $this->view->formName = $_POST['form_name']; } if (!empty($_POST['form_email']) && $l_sStatus) { $this->view->formEmail = $_POST['form_email']; } if (!empty($_POST['form_msg']) && $l_sStatus) { $this->view->formMsg = $_POST['form_msg']; } } if (isset($_POST['signUpBtn'])) { $this->email(); } $this->view->details = $this->model->getDetails(); $this->view->title = 'Contact'; $this->view->page = 'contact'; $this->view->background = 'bg7.jpg'; $this->view->artists = $this->model->aristList(); $this->view->js = array("base", "mobNav", "google-analytics"); $this->view->render('front/header'); $this->view->render('front/navigation'); $this->view->render('contact/index'); $this->view->render('front/footer'); }
function sendEmail() { $l_oContactMail = new SwiftMailer(); $l_oContactMail->subject = 'Product enquiry - ' . $_POST['form_subject']; $l_oContactMail->name = $_POST['form_name']; $l_oContactMail->email = $_POST['form_email']; $l_oContactMail->message = $_POST['form_msg']; $l_sStatus = $l_oContactMail->validate(); if (!$l_sStatus) { $l_sStatus = $l_oContactMail->contact(); if ($l_sStatus) { print json_encode(array('msg' => 'We appologise, but we were unable to connect to our mail server. Please contact us directly at annick@artaddict.eu')); } else { print json_encode(array('msg' => 'Your message has been submitted')); } } else { print json_encode(array('msg' => $l_sStatus)); } }