Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8873931
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:35:32+00:00 2026-06-14T18:35:32+00:00

In my CakePHP application I have an email form I have made myself that

  • 0

In my CakePHP application I have an email form I have made myself that opens when an email hyperlink is clicked. How do I then pass the data from the form so that it can be sent using CakeEmail? Sorry, I’ve tried this for ages and checked through all the documentation on http://book.cakephp.org/2.0/en/core-utility-libraries/email.html, still can’t figure it out.

Here is my code…

email.ctp

<?php $this->Html->addCrumb('New Email', '#'); ?>

<div id="email_page" class="span12">
    <div class="row">

    <?php 
        echo $this->Form->create('Email', array('controller'=>'person', 'action'=>'email_send'));
        echo $this->Form->input('email', array('class'=>'email_form','label'=>'To: ','value'=>$email['Person']['primEmail']));
        echo $this->Form->input('subject', array('class'=>'email_form','label'=>'Subject: '));
        echo $this->Form->input('message', array('class'=>'email_form email_body', 'type'=>'textarea','label'=>'Message: '));
        echo $this->Form->end('Send', array('class'=>'pull-right')); 
    ?>

    </div>
</div>

email_send.php

<?php
    $email = new CakeEmail('default');
    $email->to('email');
    $email->subject('subject');
    $email->send('message');
?>

Any help is appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T18:35:33+00:00Added an answer on June 14, 2026 at 6:35 pm

    Form data will be available in the Controller in $this->request->data (writable) or $this->data (readable). As your form is called Email all data will be available under $this->request->data['Email'] after the form is submitted.

    I’m not sure why you would have the email code in email_send.php instead of using a Controller method. The form expects an email_send method present in the PersonsController, as the form action is set to /persons/email_send. So I would place the email code inside email_send() in PersonsController.php.

    So:

    <?php
        public function email_send() {
          $email = new CakeEmail('default');
          $email->to($this->request->data['Email']['email']);
          $email->subject($this->request->data['Email']['subject']);
          $email->send($this->request->data['Email']['message']);
        }
    ?>
    

    Of course, when all this is working, you should set up proper validation and check if $this->request->data is populated with the relevant data.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a cakePHP application that is pulling data from two different databases, which
I have a CakePHP Application with many many screens using data from a specific
I have made a full application in JQM using cakePHP as the server side
I have developed a CakePHP application that I have now deployed to my production
Background I have a CakePHP application that lives in /m/ . I want to
I have a cakephp application made by previous employees, its structure is defined as
In my CakePHP application layout I have a section for latest posts that needs
I have a CakePHP application that uses a number of vendor classes, including one
I have a CakePHP application that allows a user to register and post projects.
I have developed a CakePHP application that does basic CRUD on a series of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.