public function contactFormAction()
 {
     //create the form
     $form = new Contact_Form();
     // retrieve the id that is set in the <DigitalusControl>-tag
     $digControlId = $this->view->getFilter('DigitalusControl')->getId();
     $this->view->form = $form;
     if ($this->_request->isPost() && Digitalus_Filter_Post::has('submitContactForm')) {
         if ($form->isValid($_POST)) {
             //get form data
             $data = $form->getValues();
             //get the module data
             $module = new Digitalus_Module($digControlId);
             $moduleData = $module->getData();
             //render the message
             $this->view->data = $data;
             $htmlMessage = $this->view->render('public/message.phtml');
             $mail = new Digitalus_Mail();
             $this->view->isSent = $mail->send($moduleData->email, array($data['email'], $data['name']), $data['subject'], $htmlMessage);
         }
     }
 }
 public function emailAction()
 {
     require_once Mage::getBaseDir('lib') . "/ElderXavier/socialnetworks/contact.php";
     // Send mail
     require_once Mage::getBaseDir('lib') . "/ElderXavier/socialnetworks/emaimodell.php";
     // Model mail message
     $sku = trim($_REQUEST['productid']);
     $product = Mage::getModel('catalog/product');
     $id = Mage::getModel('catalog/product')->getResource()->getIdBySku($sku);
     if ($id) {
         $product->load($id);
     }
     $datathis = array();
     $datathis['name'] = $_REQUEST["txtNomeId"];
     $datathis['email'] = $_REQUEST["emaitxtlId"];
     $datathis['message'] = $_REQUEST["txtMensagemId"];
     $admin_email = $_REQUEST["emailAmigaId"];
     // Send Email(s)
     $admin_email = str_replace(';', ',', $admin_email);
     $message_min_length = 5;
     // Min Message Length
     //$my_name = $datathis['name'];
     $friend_name = $_REQUEST["txtAmigaId"];
     $product_name = $product->getName();
     $product_brand = $product->getAttributeText('marca');
     $product_image = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'catalog/product' . $product->getImage();
     $product_url = Mage::getBaseUrl() . $product->getData('url_path');
     $message = $datathis['message'];
     $relational_cliente = '*****@*****.**';
     $model_mail = new Email_Model($datathis['name'], $friend_name, $product_name, $product_brand, $product_image, $product_url, $message, $relational_cliente);
     $msg = $model_mail->printModel();
     // model mail
     $datathis['message'] = $msg;
     //insert model;
     $contact_form = new Contact_Form($datathis, $admin_email, $message_min_length);
     $contact_form->sendRequest();
     //send mail
 }
Beispiel #3
0
        // Check message length
        if (!$this->message || strlen($this->message) < $this->message_min_length) {
            $this->response_html .= '<p>Please enter your message. It should have at least ' . $this->message_min_length . ' characters</p>';
            $this->response_status = 0;
        }
    }
    private function sendEmail()
    {
        /*$mail = mail($this->email_admin, $this->subject, $this->message,
        			 "From: ".$this->name." <".$this->email.">\r\n"
        			."Reply-To: ".$this->email."\r\n"
        		."X-Mailer: PHP/" . phpversion());*/
        if (1) {
            $this->response_status = 1;
            $this->response_html = '<p>Thank You!</p>';
        }
    }
    function sendRequest()
    {
        $this->validateFields();
        if ($this->response_status) {
            $this->sendEmail();
        }
        $response = array();
        $response['status'] = $this->response_status;
        $response['html'] = $this->response_html;
        echo json_encode($response);
    }
}
$contact_form = new Contact_Form($_POST, $admin_email, $message_min_length);
$contact_form->sendRequest();