1

I had created the form with some fields and when I click on the submit button it should send the email.So,I had created the phtml file sending mails but i am not getting any mails by clicking on the button.

Under CMS page I had created the new page to redirect the page.

Please help me.

  • Is your webserver/hosting supporting php mail function? Are there any errors in var/log/system.log? – versedi Oct 6 '15 at 8:23
  • yes it supports php mail function and.No errors are displaying – Annaram Ravinder Oct 6 '15 at 8:52
  • Check your apache server error log. – versedi Oct 6 '15 at 8:59
0

You can send email using "Edit Email Template". Click here for more detail.

0
<?php
public function sendMailAction(){
$html="
put your html content here
blah blah

";
$mail = Mage::getModel('core/email');
$mail->setToName('Your Name');
$mail->setToEmail('Youe Email');
$mail->setBody('Mail Text / Mail Content');
$mail->setSubject('Mail Subject');
$mail->setFromEmail('Sender Mail Id');
$mail->setFromName("Msg to Show on Subject");
$mail->setType('html');// YOu can use Html or text as Mail format

try {
$mail->send();
Mage::getSingleton('core/session')->addSuccess('Your request has been sent');
$this->_redirect('');
}
catch (Exception $e) {
Mage::getSingleton('core/session')->addError('Unable to send.');
$this->_redirect('');
}
}
?>
0

I tested your sendmail.phtml code on my dev server and can confirm that it does send an email, so the problem must lie somewhere with your server mail system.

Do other emails work correctly?

To test email from the command line you can do

echo "This is a test." | mail -s Testing your@email.address

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.