2011年1月21日星期五

[fw-mvc] Zend Email

Hello All,

I am trying to create a Contact Us page using the Zend framework, and it's behaving strangely....I sent out a bunch of test emails for various configurations of the code in the controller, and I received the emails this morning. I'm currently testing it on my local environment, which is Mac OS X, with Darwin OS. I feel like I'm dancing around with the code, but just not getting the correct configuration for sending email from a Zend/PHP class.

This is the code I am using right now:

require_once ('Zend/Mail.php');
//$tr = new Zend_Mail_Transport_Smtp('localhost');
// Zend_Mail::setDefaultTransport($tr);
$mail = new Zend_Mail();
$mail->setBodyText('$message');
$mail->setFrom($yourEmail, 'Thomas List');
$mail->addTo($to, 'Thomas List');
$mail->setSubject($subject);
$mail->send();

I am not sure which way to go on this one...it seems that there are several solutions out there on the web, but they don't seem to work either. Any ideas would be very much appreciated.

Regards,
Thomas

没有评论: