Solved

CAKEPHP: Simple Contact Form within Controller

Posted on 2009-07-10
5
635 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
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 …

717 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