Hello all, I am building my first site with cakephp and Im now putting
together a simple contact form for the site but Im running into
problems. Ideally Id like to use phpmailer. But I cant find much info
on setting this vendor up in the framework.

Ive been to http://bakery.cakephp.org/articles/view/sending-email-with-phpmailer
but didnt help much and I cant find any tutorials online on setting
this up.

What I have so far is the method explained in the link above. I guess
I want to know how you tie it all together. On my contact form, how do
I tell it to go and send the email? Every time I hit submit it tells
me either it cant find the controller (because it keeps looking for
plural name -which my controller is singular-static page) or if I
change the action in the form then it cant find the view.

Im running cake 1.2 and php5.

My current code receiving this error is as follows:
---------------------
ERROR
---------------------
Missing View
Error: The view for ContactController::display() was not found.
Error: Confirm you have created the file: /nfs/c03/h03/mnt/53057/
domains/dzinewize.com/html/client_dev/network_fitness_cake/app/views/
contact/send.ctp
Notice: If you want to customize this error message, create app/views/
errors/missing_view.ctp

------------------
CODE
------------------
Controller: (with no model associated)
contact_controller.php @path: app/controllers/
<code>
<?php
class ContactController extends AppController{

        var $name = 'Contact';
        var $components = array('Email');
        var $helpers = array('Html');
        var $uses = array();

        function display() {
                $this->set('site_section', 'sect-contact');
                $this->set('sect_title', 'Contact : ');
                $this->layout = 'content';
        $path = func_get_args();
                if (!count($path)) {
                        $this->redirect('/');
                }
        $count = count($path);
        $page = $subpage = $title = null;
                if (!empty($path[0])) {
                        $page = $path[0];
                }
                if (!empty($path[1])) {
                        $subpage = $path[1];
                }
                if (!empty($path[$count - 1])) {
                        $title = Inflector::humanize($path[$count - 1]);
                }
                $this->set(compact('page', 'subpage', 'title'));
                $this->render(join('/', $path));

        }// end display()

        function send() {

            $this->set('data', $data);
            $this->Email->to = '[email protected]';
            $this->Email->subject = 'my test email';

            $result = $this->Email->send();


      }// end send()


}
?>
</code>

View: (the form)
contact.php @path: app/views/contact/
<code>
        <?php echo $form->create(array('Contact', 'type' => 'post',
'action' => 'send')); ?>
        <fieldset>
        <h5>Contact Info</h5>
        <ul class="form">
                <li><?php echo $form->input('Name', array('type' => 'text',
'name' => 'name')); ?></li>
                        <li><?php echo $form->input('Email'); ?></li>
            <li><?php echo $form->input('Phone'); ?></li>
        </ul>
        <h5>Message</h5>
        <ul class="form">
            <li class="text-area"><?php echo $form->textArea
('message'); ?></li>
        </ul>

        <br />

                <?php echo $form->submit('Send Message'); ?>

        </fieldset>
        <?php echo $form->end(); ?>
</code>

And then I have the component email.php with the contents as described
in the link above.

Ive been trying to figure this out for about 3 days now and Im not
finding any additional helpful info on the web so any help on getting
this simple send mail function is greatly appreciated.

If supplying a link to the contact form helps, then just let me know
and Ill email it your way.

Thanks guys!

justclint

--~--~---------~--~----~------------~-------~--~----~
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