Solved

CAKEPHP: Simple Contact Form within Controller

Posted on 2009-07-10
5
600 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
  • 2
5 Comments
 
LVL 5

Accepted Solution

by:
DolGuldur earned 500 total points
Comment Utility
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
Comment Utility
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

762 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now