CAKEPHP: Simple Contact Form within Controller

This URL:


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.
Who is Participating?
DolGuldurConnect With a Mentor Commented:

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 <>';
$this->Email->to      = 'Somebody Else <>';
$this->Email->subject = 'Test';

Change the variables to reflect what you want and there you will receive an email when someone unsubscribe.
Additional information on how to send simple message using the Email component in CakePHP
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.