Hey all,

I am currently running a cake site off a home server. Because of this,
when I use the EmailComponent within cake, I have to use SMTP. I was
able to get my page up and running sending out emails with SMTP,
however I noticed that when using SMTP I cannot pass any arguments
(the body of the email) to the send() method. If I try to I will still
get a confirmation that the email has been sent, but I never receive
it. If I do not pass any arguments to the send() method I get the same
confirmation and will receive the email almost instantly. My question
is how would I go about including the body of the email being sent and
still get the email to actually send using SMTP? I have included the
"contacts_controller.php" used in my app. Any help is greatly
appreciated as I am stuck : /

<?php

        class ContactsController extends AppController {

                var $name = 'Contacts';
                var $components = array('RequestHandler', 'Email');

                function index() {

                        if ($this->RequestHandler->isPost()) {

                                $this->Contact->set($this->data);

                                if ($this->Contact->validates()) {

                                        //send email using the Email component
                                        $this->Email->smtpOptions = array(
                                                                                
                        'port'          => '25',
                                                                                
                        'timeout'       => '30',
                                                                                
                        'host'          => 'smtp.xxxxxx.xxx'
                                                                                
                        );
                                        $this->Email->delivery = 'smtp';
                                        $this->Email->to = 
'[email protected]';
                                        $this->Email->subject = 'Contact 
message from ' . $this->data
['Contact']['name'];
                                        $this->Email->from = 
$this->data['Contact']['email'];

                                        if ($this->Email->send()) {

                                                $this->flash('Your email has 
been sent.', '/contacts');

                                        } else {

                                                $this->flash('Your email has 
NOT been sent.', '/contacts');
                                        }

                                }

                        }

                }

        }

?>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to