eZ Community » Forums » Developer » [ez 4.7] Send back a specific mail...

[ez 4.7] Send back a specific mail after form validation

[ez 4.7] Send back a specific mail after form validation

Wednesday 01 April 2015 12:56:46 pm - 3 replies

Hello everybody !


I need to send two mail after a form validation.

The first mail is all the form content for the form recipient. The second mail must be send in same time to the first mail's sender. His content will be defined in a form class.


I know how send a form content to my recipient, but I don't know how to send back the second mail.


I tried to do this :

- In my form tpl, when the user submit the form I send this action : "MultiSendAction"

- I created a content_actionhandler in my extension and declared it in content.ini


If I try to print_r something after form validation, it's a success. So I think that my actionhandler is ok.


Now, I would like to create a module based on kernel collectinformation.

(Send an action when form is validate, go to my action handler, run my module, run my php script who send two mails)


So, I created a module in my extension and declared it in module.ini.

In this module, I have a module.php where I copy/paste a ViewList['xxx'] like $ViewList['collectinformation'] in kernel/content/module.php


$Module = array( 'name' => 'myModule' ); 
$ViewList = array();

$ViewList['collectinformationtwo'] = array(
    'functions' => array( 'read' ),
    'default_navigation_part' => 'ezcontentnavigationpart',
    'script' => 'collectinformationtwo.php',
    'single_post_actions' => array( 'ActionCollectInformation' => 'CollectInformation' ),
    'post_action_parameters' => array( 'CollectInformation' => array( 'ContentObjectID' => 'ContentObjectID',
                                                                      'ContentNodeID' => 'ContentNodeID',
                                                                      'ViewMode' => 'ViewMode' ) ),
    'params' => array(  ) );


I call my module like in kernel/action/action.php

 $module = $Params['Module'];
return $module->run( "myModule", array() );



As a beginner on ez publish I'm a bit lost. I read documentations about forms, modules and kernel override, but I don't find a solution to my problem.

What's my mystake ? (or my mystakeS big-smile.gif Emoticon)





Wednesday 01 April 2015 3:15:25 pm

Hello Patrick,

Sadly the feature you describe is not supported by default!

A word of warning. It is strongly discouraged to edit any part of the kernel, this is called 'Kernel Hacking' and it is a very bad idea for very many reasons. In short it's the absolute worst way to create a solution within eZ Publish. You need to learn to create your solutions only within extensions! http://www.ezpedia.org/ez/kernel_hack

I think some of your requirements are very similar to another recent request from a different user, http://share.ez.no/forums/developer/how-to-send-verification-email-to-customer-filling-in-a-form#comment84922

I think this feature you describe is also a bad idea as spammers and robots would abuse this feature to send spam out to anyone and everyone without restriction or limits. This would be very bad.

If you still feel this feature is required ... and you do not need to use the information collection system to store your form submission content into the database I would suggest creating a simple custom extension module view to submit your forms to instead.

If you still feel this feature is required ... and you do need the information collection system form submission storage you could implement a custom copy of the content module in an extension to provide this feature (I've done this before myself).

Either of these solutions would avoid a kernel hack and allow you the freedom to implement the custom php solution you desire.

Here are some articles about creating custom extension module views which you need to read and practice with:



I forgot to mention that content_actionhandler(s) are separate with regard to what your trying to do and I do not think they will work for your needs.

I've tried to use them long ago in the past in the same way as you and they simply were separate and did not share access to the information submitted / stored ... I think, to be honest it's been a long time as I say but I do remember the right answer here is to avoid a content_actionhandler and go with a custom extension module view instead. 

I hope this helps!


Wednesday 01 April 2015 5:31:17 pm

Thank you Heath,


you're my savior for second time big-smile.gif Emoticon

For now I'm not really less lost, but you confirm my feelings, that I will forced to do a module.

So ... let's go to learn how to do a module (thanks for links)

I don't set the topic as solved for now, I will edit my post if it was the good way to do for my case. (if another newbie like me read it someday big-smile.gif Emoticon)


thank you again blunk.gif Emoticon


[EDIT] : everything works with a module happy.gif Emoticon

Modified on Thursday 02 April 2015 2:42:49 pm by Patrick P.

Thursday 02 April 2015 2:53:50 pm

Hello Patrick,

Congratulations! Your very welcome, I was happy to help!



You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from