How can I send form data to a preset email address in Magento (like how the contact form works) ?
EDIT : What I开发者_运维知识库'm trying is to have a form in a static block which when submitted, sends the form data to an email address (admin@mystore.com)
im not sure what you need. Heres an example for a custom static formular. All you need is to create a phtml template and this add into a cms page.
in RTE:
{{block type="core/template" name="myformular" template="contacts/myformular.phtml"}}
or in xml layout
<reference name="content">
<block type="core/template" name="myformular" template="contacts/myformular.phtml" />
</reference>
inside that phtml file you can design your mail with plain php
How to send email with php
// Send mail:
$mail = Mage::getModel('core/email')
->setToName('Prajapati jignesh')
->setToEmail('jignesh@gmail.com')
->setBody('Message body')
->setSubject('Message subject')
->setType('text'); // or html
try{
$mail->send();
}
catch(Exception $error)
{
// Could not send email
}
精彩评论