This forum is no longer open and is for reading/searching only.

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 2

Customizing email

  1. tariqali


    Is there away to customize the email that is sent when someone submit a form? Right now all I see is tags for {form_name} and that is it. I would like to be able to use some of the form fields in the email subject, email from, etc. That way I can just hit the reply button in my email and send back a reply to the sender instead of looking for the person email. Is this something I can do?

    Also, it would be nice if we can choose if we want the form submissions to be entered in the database or just send out an email.


    Posted 13 years ago #
  2. yuniar


    To fully customize the email, you will need to modify includes/helper-functions.php file.
    Around line 421 - 471 you will see all the inner code to prepare the email.

    Basically you can use $table_data['xxxx'] variable to access all your form data.

    xxxx is your form field name (right click on your form and view the HTML source to find it)

    So let's take an example of this form:

    If you would like the Email field (element_2) to be the sender of your notification email, then you can insert this code:

    if($form_id == 4){
      $mail->From = $table_data['element_2'];

    Put that code above into line 466, right above this line:

    $mail->Body = $email_body;

    It's pretty much a hack for now. I'm currently working on easier option so that you could use an easy template and variable to customize the whole email.

    Regarding the email/database switch option, thanks, I'll consider this as more people seem to need it.

    Let me know if you need further help.

    MachForm Founder

    Posted 13 years ago #
  3. tariqali

    Thanks for the reply. I will try to do the hack but I would rather avoid doing so since I am no expert with PHP.

    It would be great to add this in your next release as it will make handling emails much easier.

    Thank you.

    Posted 13 years ago #
  4. yuniar

    Definitely, this is one of the most requested feature. I'm working on it.

    MachForm Founder

    Posted 13 years ago #
  5. MatthewGrdinic

    I'd also throw in here and say this would be very nice to see!

    Posted 13 years ago #
  6. sub

    Oh yeah, an absolute musthave! I really cant get it to work in php

    Posted 13 years ago #
  7. elderban

    I would like to be able to customize the output as well.

    I noticed the current version will post every anwer even if they didn't answer it, especially if it's a "checkbox" question. If they don't answer a question, the answer shouldn't be included (looks a little confusing).

    Additionally, I noticed that if the question is a checkbox question that it will only show the answers, not the questions.

    Any word when the new version will be available?

    Posted 13 years ago #
  8. yuniar

    New version will be released by the end of this month.

    I'm glad to announce some fact regarding the new version:

    - Yes, you will be able to completely customize the email (subject, sender, content) from the admin panel. All form fields are available as {element_X} variable. So you can put it anywhere on your email.

    - It will only post answered questions. Empty answers will be discarded.
    - Checkboxes will be grouped. So the question will be displayed too.

    Hope you like it :-)

    MachForm Founder

    Posted 13 years ago #

RSS feed for this topic