check your local mail log to ensure its definitely being sent. Not
sure where you would find this on Mac OS X but is located @
/var/log/mail.log for most linux distributions. It may well be your mta
isn't running, or not doing what it should.
Also I'm guessing $to is a valid email address?
Also it may be the address your sending it to is catching it as spam if
you've not correctly configured an MX record for the domain your sending
form. Check you junk / spam folder to make sure its not fallen into any of
those.
As far as the syntax goes, it looks like you've got it pretty spot on to me.
On Fri, Jan 21, 2011 at 3:41 PM, Thomas List <thomaslist@hotmail.com> wrote:
>
> 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
>
没有评论:
发表评论