Friday, March 29, 2013

Re: New to CakePHP

From the name of the controller file it appears that you're dealing with a 1.x install. Keep that in mind going forward, as there have been some changes to the API. If in doubt about any advice you receive, make a point of asking whether it's meant for a 1.x or 2.x version.

First thing to do is open app/config.routes.php and look for a path that matches what you're seeing in the browser. If you don't find it, then the URI itself probably contains everything you need to locate which controller/action you're dealing with. If the URI is "/contacts/email" then what you found is indeed the thing to focus on.

Next, open up app/config/bootstrap.php and look for lines like Configure::write('Site.contact_email', 'some address here'); If you don't find these lines add one for every ::read() you see.

You can use $this->log($someVar); anywhere in the controller. Pass it a string, array, object, whatever. Look in app/tmp/logs to see what you're getting. If there's supposed to be a user-provided msg from POST, that should be in $this->data:

if (!empty($this->data)) {
  $this->log($this->data);
  ...

You might want to consider emptying the logs first to make your job easier. (Keep a copy in case there's something in there that's important.) Make sure that the logs -- in fact everything in tmp -- is writable by the webserver process.

Can you post the relevant action (method)? It may be using Cake's built-in EmailComponent, or a plugin, or something else, so any more advice at this point would be guesswork. The mail might be using a local SMTP server, or it might be remote, etc. Check the $components array at the top of the class for anything that looks relevant to email. Ditto any imports.


On Wed, Mar 27, 2013 at 1:32 PM, Ellie Quick <ellie.quick78@googlemail.com> wrote:
Help,

Im a fairly experienced php coder however Ive been given access to a site (as the author is no longer contactable) written using CakePHP and Im totally and utterly lost as to how to make the fairly urgently required fixes.

Theres a contact form on one of the pages which doesnt work, no error messages to say whats wrong, Its meant to send an email to the site owner but nothing is ever received. Now this could be as simple as the wrong email address being used through to there simply being no back end code for sending the mail.

ive found a file called "contacts_controller.php" which contains an email function which is clearly designed to send the relevant emails however the bit thats losing me is:

$email_to = Configure::read('Site.contact_email');
$email_subject = Configure::read('Site.contact_email_subject');
$email_from = Configure::read('Site.contact_email_from');

I cant find anywhere, either in the site server files or the relevant database anything that appears to hold these variables.

Am I being dim?

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments: