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

  • Home
  • SEARCH
  • 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 9248445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:56:47+00:00 2026-06-18T09:56:47+00:00

Background I have a script that sends an email. This email is sent fine.

  • 0

Background

I have a script that sends an email. This email is sent fine. It sends the template, the design is working fine and all the hard coded text is in there.

Problem

Although the mail sends fine, all the variables are missing.

Code

Here is my email template, boardroom_email.ctp in the APP/View/Emails/html/ folder:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
  </head>

  <body bgcolor="#CCCCCC">
    <table width="800" align="center" bgcolor="#8dc641" cellpadding="0" cellspacing="0">
      <tr>
        <td>
          <!-- Header Image -->
        </td>
      </tr>
      <tr>
        <td style="font-family:Arial, Helvetica, sans-serif; font-size:18px; font-weight:bold"><h3 align="center">New Boardroom Booking</h3></td>
      </tr>
      <tr>
        <td style="padding:10px">
          <table width="100%" cellpadding="5" cellspacing="5" style="font-family:Arial, Helvetica, sans-serif; font-size:14px" bgcolor="#FFFFFF">
            <tr>
              <td colspan="2">
                The following Boardroom Booking has been made
              </td>
            </tr>
            <tr>
              <td width="30%">
                <b>Requested By:</b>
              </td>
              <td width="70%">
                <?php echo $BoardroomBooking['BoardroomBooking']['name'] ?>
              </td>
            </tr>
<!-- File truncated because the rest just repeats the above variable -->

Over here is the function in the BoardroomBookingsController that get’s called when a record is successfully saved.

function _sendNewBoardroomBookingMail($id) {
    $BoardroomBooking = $this->BoardroomBooking->read(null,$id);
    $this->Email->to = array('Person 1 <person1@mycompany.com>', 'Person 2 <person2@mycompany.com>');
    $this->Email->subject = 'A new boardroom booking has been made';
    $this->Email->replyTo = 'no-reply@mycompany.com';
    $this->Email->from = 'My Company Intraweb <no-reply@mycompany.com>';
    $this->Email->template = 'boardroom_email';
    $this->Email->sendAs = 'html';
    $this->set('BoardroomBooking', $BoardroomBooking);
    $this->Email->delivery = 'smtp';
    $this->Email->_debug = true;
    if ($this->Email->send()) {
        return true;
    } else {
        return false;
    }
}

Result

This is what the above code sends me:

enter image description here

Question

Obviously I’m missing something small. I had it working at one stage and can’t remember that I changed anything, but now, it sends me an email with no data.

What is it that I’m missing?

  • 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-18T09:56:49+00:00Added an answer on June 18, 2026 at 9:56 am

    $this->set('BoardroomBooking', $BoardroomBooking); doesn’t work in the new CakeEmailComponent

    You need to use:

    $this->Email->viewVars(compact('BoardroomBooking'));
    //or
    $this->Email->viewVars(array('BoardroomBooking' => $BoardroomBooking));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a python script that I want always to run in the background.
I have a script that, inserts into the database e.g. 20,000 users with email
I have a python script that can run for long time in the background,
to interact with my iPhone, i have created a python script that sends and
I have a PHP script that runs in the background to post any pictures
I have a web page that sends a request to a cgi script that
I have a script that occasionally needs to do some time-consuming (15s) background processing,
I have a script that is executed periodically in the background. I want to
i have a script that creates divs with some background image then moves them,
I have developed a script in linux bash that is running in background and

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.