I want to send a custom email to the customer just after submitting a Feedback Form. For Submitting the form I created a Controller Action

here is my action file

use Magento\Framework\App\Action\Context;
use Feedback\Addon\Model\InsertFactory;

class Save extends \Magento\Framework\App\Action\Action
     * @var Test
    protected $_test;

    public function __construct(
        Context $context,
        InsertFactory $test
    ) {
        $this->_test = $test;
    public function execute()

        $post = $this->getRequest()->getPostValue();
        $test = $this->_test->create();

                        'first_name'=> $post['first_name'],
                        'last_name'=> $post['last_name'],
                        'email' => $post['email'],
                        'mobile_no' => $post['mobile_no'],
                        'feedback_content' => $post['feedback_content']


            $this->messageManager->addSuccessMessage(__('You saved the data.'));
            $this->messageManager->addErrorMessage(__('Data was not saved.'));
        $resultRedirect = $this->resultRedirectFactory->create();
        return $resultRedirect;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.