Solved

CAKEPHP: Simple Contact Form within Controller

Posted on 2009-07-10
5
625 Views
Last Modified: 2013-12-13
This URL:

.../consumers/unsubscribe/id:123

is embedded in an email, and allows for a user to opt out of future emails. On this same page, the "unsubscribe" view, I have a simple form with a textarea and a submit button, and I would like to allow the user to submit feedback as to why they are unsubscribing.

But I am not storing the data anywhere. Just emailing it. So how would I do this?

Thank you.
0
Comment
Question by:edvinson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 5

Accepted Solution

by:
DolGuldur earned 500 total points
ID: 24879531
Hi,

Add the Email component to your consumers controller. In your unsubscribe action, add something similar to this after record deletion:

if ($this->Model->del($id)) {
$this->Email->from    = 'Somebody <somebody@example.com>';
$this->Email->to      = 'Somebody Else <somebody.else@example.com>';
$this->Email->subject = 'Test';
$this->Email->send($this->data[modelName][textareaName]);
}

Change the variables to reflect what you want and there you will receive an email when someone unsubscribe.
0
 
LVL 5

Expert Comment

by:DolGuldur
ID: 24879553
Additional information on how to send simple message using the Email component in CakePHP

http://book.cakephp.org/view/269/Sending-a-basic-message
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question