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 8291877
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T13:16:49+00:00 2026-06-08T13:16:49+00:00

I am trying to send an email from CakePHP 2.1.2 via console shell (eventually

  • 0

I am trying to send an email from CakePHP 2.1.2 via console shell (eventually by a cron job). The view I am sending is a calendar with links back to the applications web page. The problem I am finding is that the urls do not include the correct path and from what I have read it is because there is no request object since I am using the console. For example, if I create the view in my browser I get links like this:

http://localhost/ReportMonitor/scheduledReports/index/show_date:2012-06-10/result:GOOD

but in the email using the same code I get this:

http://localhost/scheduledReports/index/show_date:2012-06-10/result:GOOD

which is close, but no cigar.

I have been trying to find the global that I can set somewhere to just hard code the app subdirectory but haven’t found anything that works yet. The links are made by a code like this:

$newUrl = array();
$newUrl['controller'] = 'scheduledReports';
$newUrl['action'] = 'index';
$newUrl['url'] = array();

foreach ($data as $key => $value) {
  $newUrl['show_date'] = "$year-$month-$key";
  $newUrl['result'] = 'GOOD';
  $data[$key]['num_complete'] = $this->Html->link(__('Complete: ') . $value['num_complete'], Router::reverse($newUrl, true), array('class' => 'green'));

I would think this is a common function (sending valid urls in console generated email) but I just can’t figure it out.

Thanks

  • 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-08T13:16:51+00:00Added an answer on June 8, 2026 at 1:16 pm

    Use the full_base option in the links

    echo $this->Html->link(array(
        'controller' => 'posts', 'action' => 'index', 'full_base' => true
    ));
    

    and set the FULL_BASE_URL constant in bootstrap.php to your base-url:

    define('FULL_BASE_URL', 'http://www.domain.com/subdir');
    

    If you are using routes for your app, you need to include routing in your shell:

    App::uses('Router', 'Routing');
    config('routes');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to send an e-mail from a cron using CakePHP shell but
I'm trying to send an email from a CakePHP shell just as you would
I am trying to send email using Exchange 2007 from a console app using
I am trying to send an email via Outlook from within a VB6 program.
I am trying to send an email from a CakePHP controller with the url
I'm trying to send an email from AppController in my CakePHP 2.0 app. It
I'm trying to send an email from c# code via our company's exchange server.
I am trying to send an email via GMail from ASP.Net using the code
I'm trying to send email via google apps from my asp.net app and am
I am trying to send an email from a Ruby program. The smtp server

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.