I made a custom form using instructions found at Inchoo. I've created the form and it's appearing properly but the mails are not sending at all. I get an error 'Unable to Send email' which comes from the catch
part of the code. Nothing in the system.log or exceptions.log files to give me a clue.
The form has an action of domain.com/postajob/index/sendemail/
and my IndexController.php file looks like this
<?php
class BWD_JobForm_IndexController extends Mage_Core_Controller_Front_Action
{
public function sendemailAction()
{
//Fetch submited params
$params = $this->getRequest()->getParams();
$from_email = Mage::getStoreConfig('trans_email/ident_general/email');
$from_name = Mage::getStoreConfig('trans_email/ident_general/name');
$mail = new Zend_Mail();
$mail->setBodyText($params['role']);
$mail->setFrom($from_email, $from_name);
$mail->addTo($params['email'], $params['name']);
$mail->setSubject('Test Post a Job Module for Magento');
try {
$mail->send();
}
catch(Exception $ex) {
Mage::getSingleton('core/session')->addError($ex->getMessage());
}
//Redirect back to index action of (this) inchoo-simplecontact controller
$this->_redirect('thanks/');
}
}
?>
I've also tried methods mentioned here and here but none of them work. For the record, mail sending is enabled in the configuration.