I needed to use the Zend Mail API from the Zend Framework. I have done the following configuration but it is not working
1) PHP.INI
SMTP = "mail.e11online.com "
smtp_port = 521
sendmail_from = [EMAIL PROTECTED]
2) I have written the following code in the controller
Zend::loadClass('View_dbhandler');
$dbhandler = new View_dbhandler();
$to = $_POST['to'];
$cc = $_POST['cc'];
$bcc = $_POST['bcc'];
$from = " [EMAIL PROTECTED]";
$subject = $_POST['subject'];
$bodyText = $_POST['bodyText'];
$dbhandler->compose($to, $cc, $bcc, $from, $subject, $bodyText);
3) This the PHP file in which I have defined the dbhandler class and the compose method
require_once('Zend/Mail.php');
require_once('Zend/Mail/Transport/Smtp.php');
$tr = new Zend_Mail_Transport_Smtp(' mail.value-one.com');
Zend_Mail::setDefaultTransport($tr);
class View_dbhandler
{
function compose($to, $cc, $bcc, $from, $subject, $bodyText)
{
$mail = new Zend_Mail();
$mail->setBodyText($bodyText);
$mail->setBodyHtml($bodyText);
$mail->setFrom($from);
$mail->addTo($to);
$mail->setSubject($subject);
$mail->send();
}
}
require_once('Zend/Mail/Transport/Smtp.php');
$tr = new Zend_Mail_Transport_Smtp(' mail.value-one.com');
Zend_Mail::setDefaultTransport($tr);
class View_dbhandler
{
function compose($to, $cc, $bcc, $from, $subject, $bodyText)
{
$mail = new Zend_Mail();
$mail->setBodyText($bodyText);
$mail->setBodyHtml($bodyText);
$mail->setFrom($from);
$mail->addTo($to);
$mail->setSubject($subject);
$mail->send();
}
}
Please let me know if I am doing anything wrong. A quick reply would be highly appreciated.
Regards,
Manu Goel
Value One
