Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $mail->setBody('Mail Text / Mail Content');
- $mail->setBodyHTML($body);
- $mail->setType('html');
- <?php
- class Onlineservice_Module_IndexController extends Mage_Core_Controller_Front_Action
- {
- public function indexAction()
- {
- $this->loadLayout();
- $this->renderLayout();
- }
- public function postAction()
- {
- $post = $this->getRequest()->getPost();
- if ($post){
- try {
- $firstname = $post["first_name"];
- $lastname = $post["last_name"];
- $email = $post["email"];
- $phone = $post["phone"];
- $message = $post["message"];
- $to = "compuhousenet@gmail.com";
- $subject = "Compu House Request for Online Services";
- $body .= "<p>The following customer have requested an online service from Compu House Website.</p>";
- $body .= "<p>Name : " . $firstname . "" . $lastname . "<p>";
- $body .= "<p>Email : " . $email . "<p>";
- $body .= "<p>Phone : " . $phone . "<p>";
- $body .= "<p>Message : " . $message . "<p>";
- $body .= "<br/><p>Kind regards,</p><p> Compu House Webmaster</p>";
- $from = $email;
- $mail = Mage::getModel('core/email');
- $mail->setToName('Mr. Bassam Salha');
- $mail->setToEmail($to);
- $mail->setBody('Mail Text / Mail Content');
- $mail->setSubject($subject);
- $mail->setFromEmail($from);
- $mail->setType('html');// YOu can use Html or text as Mail format
- $mail->setBodyHTML($body); // your content or message
- $mail->send();
- Mage::getSingleton('core/session')->addSuccess('Your inquiry was submitted and will be responded to as soon as possible. Thank you for contacting us.');
- $this->_redirect('*/*/');
- return;
- } catch (Exception $e) {
- Mage::getSingleton('core/session')->addError('Unable to submit your request. Please, try again later');
- $this->_redirect('*/*/');
- return;
- }
- } else {
- $this->_redirect('*/*/');
- }
- }
- }
Add Comment
Please, Sign In to add comment