Note that there are some explanatory texts on larger screens.

plurals
  1. POsending mail in magento
    primarykey
    data
    text
    <p>How to send email in magento writing an action in index controller?</p> <p>my index controller;</p> <pre><code>public function postAction() { $post = $this-&gt;getRequest()-&gt;getPost(); if(!$post) exit; $translate = Mage::getSingleton('core/translate'); $translate-&gt;setTranslateInline(false); try { $postObject = new Varien_Object(); $postObject-&gt;setData($post); if (!Zend_Validate::is(trim($post['email']), 'EmailAddress')) { echo '&lt;div class="error-msg"&gt;'.Mage::helper('contacts')-&gt;__('Please enter a valid email address. For example johndoe@domain.com.').'&lt;/div&gt;'; exit; } $storeId = Mage::app()-&gt;getStore()-&gt;getStoreId(); $emailId = Mage::getStoreConfig(self::XML_PATH_SAMPLE_EMAIL_TEMPLATE); $mailTemplate = Mage::getModel('core/email_template'); $mailTemplate-&gt;setDesignConfig(array('area'=&gt;'frontend', 'store'=&gt;$storeId)) -&gt;setReplyTo($post['email']) -&gt;sendTransactional($templateId, $sender, $email, $name, $vars=array(), $storeId=null) if (!$mailTemplate-&gt;getSentSuccess()) { echo '&lt;div class="error-msg"&gt;'.Mage::helper('contacts')-&gt;__('Unable to submit your request. Please, try again later.').'&lt;/div&gt;'; exit; } $translate-&gt;setTranslateInline(true); echo '&lt;div class="success-msg"&gt;'.Mage::helper('contacts')-&gt;__('Your inquiry was submitted and will be responded to as soon as possible. Thank you for contacting us.').'&lt;/div&gt;'; } catch (Exception $e) { $translate-&gt;setTranslateInline(true); echo '&lt;div class="error-msg"&gt;'.Mage::helper('contacts')-&gt;__('Unable to submit your request. Please, try again later.').$e.'&lt;/div&gt;'; exit; } } </code></pre> <p>is there any wrong.. please help me to out of this.. Thanks in advance..</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload