Last updated 28 October 2015. Created on 11 July 2012.
Edited by joshuautley, ciss, rdrh555, gagarine. Log in to edit this page.

Entityform uses the Rules module for its notification system. When editing an Entityform Type, you can select rules to be run upon saving an Entityform Submission under Structure > Entityform Types > [form] and clicking the Rules tab. Rules and Rules Components that are tagged with "entityform submission" will be shown in this list.

Installation

  1. Install and enable Rules and Rules UI. Note: if Rules UI is disabled, then the Entityform Rules will not show up.
  2. Install and enable Entityform.
  3. Entityform Notifications requires the Entity Rules and Entity To Text modules.
  4. Create an Entityform Type.
  5. Navigate to Structure > Entityform Types > [form] > Rules.
  6. Configure the notification settings as desired.

Note: there are also settings at Configuration » Content authoring » Entityform settings. (I assume these are for defaults that will be used when creating a new Entityform Type, but this needs confirmation from the module maintainer.)

Notification Settings > Notification Emails - send to multiple recipients

  • In order to send notification emails to more than one recipient the addresses must be separated by a comma and a space: notify1@example.com, notify2@example.com. If there is not space after the comma you will receive an error that the addresses are invalid.

Entityform Rules

There two default Rules that come with the module:

  1. Email Entityform Submitter: Sends an email to the submitter.
  2. Email Entityform Admin: Sends an email to the email addresses specified in the Notification Emails property of the Entityform Type.

To view the settings for these Rules Components, navigate to Configuration » Workflow » Rules » Components. You can clone these Rules Components or make your own.

Rules Components must have two parameters:

  • An Entityform: this is the submission.
  • An Entityform Type: this is the type of form the submission is.

How to send the email to an email address on the Entityform

For forms where the email address is filled in as part of the Entityform, it is useful to be able to send the email to that address. You can use Rules to do this as follows:

  1. Go to Configuration > Workflow > Rules then click the tab: Components.
  2. Click "clone" link for the Email Entityform Submitter component.
  3. Fill in the "Name" with something unique to your site.
  4. Leave the "entityform submission" tag and all "Variables".
  5. Click "Save changes" button.
  6. Click "edit" for the "Send email" action.
  7. For the "TO" data selector, click on "Switch to the direct input mode" button to get all available tokens.
  8. Click the "REPLACEMENT PATTERNS" fieldset link.
  9. Find your token. For example, if your email field is called email_address then the token should be [entity:field-email-address].
  10. Copy the token and paste it into the "TO" "Value" text area.
  11. Update the other rule fields as needed: Subject, Message, From, Language.
  12. Click "Save" button.
  13. Click "delete" for the "NOT User has role(s)" item in the "Conditions" section. This is for only sending email to logged-in users.
  14. Click "Save changes" button.
  15. Navigate back to your Entitytype edit form.
  16. Unselect the "Email Entity Submitter" rule and select your new custom rule. Make sure to also keep the "Email Entityform Admin" rule selected if desired.
  17. Click "Save entityform type" button.
  18. Now test your Entityform to see if the notification email is sent to the email address entered into the appropriate email form field.

How to update the Entityform admin notification email

It is useful to have the URL to the new Entityform submission within the email message that is sent to the "Notification emails" email addresses for the Entityform. You can use Rules to do this as follows:

  1. Go to Configuration > Workflow > Rules.
  2. Click "clone" link for the Email Entityform Admin component.
  3. Fill in the "Name" with something unique to your site.
  4. Leave the "entityform submission" tag and all "Variables".
  5. Click "Save changes" button.
  6. Click "edit" for the "Send email" action.
  7. For the "Message" "Value" text area, add any desired information and tokens. For example, for the URL for the submission, you could add URL: [entityform:url].
  8. Click the "REPLACEMENT PATTERNS" fieldset link to see all available tokens.
  9. Update the other rule fields as needed: To, Subject, From, Language.
  10. Click "Save" button.
  11. Navigate back to your Entitytype edit form.
  12. Unselect the "Email Entity Admin" rule and select your new custom rule. Make sure to also keep other rules selected if desired.
  13. Click "Save entityform type" button.
  14. Now test your Entityform to see if the admin notification email contains the desired information.

Learn more about Rules and Rules Components.

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.

Comments

ace11’s picture

How about then if email address is in node field. How to congfigure rules then? Have tryed in different ways but have not succeed to get it work.

Alauddin’s picture

Dalkh’s picture

I use entityform in views nodes, but don't use it with entityreference. How can I get the nodes url's?

gmasky’s picture

Is there any documentation for the v2 branch of Entity specifically the Notifications part

tedbow’s picture

Not yet.

jtbrenna’s picture

It seems that both my default submission rules are missing. How can I re-create them? I'm not sure of the conditions or actions that were included but any help would be great!

tedbow’s picture

Please provide more information such as version of Entityforms and if it is this fresh install of Drupal.

jtbrenna’s picture

Entityforms is version 7.x-1.1 and it is not a fresh install of drupal. Other modules have been installed as well as some custom ones.

tedbow’s picture

Do you the "Entityforms Notifications" module on?

Darth_Beholder’s picture

I have the same issue. There are no active Entity entityform_submission rules.
Entityforms and Entityforms Notifications are 7.x-2.0-beta1, Entityforms Notifications is on.
I understand that they are needed for e-mail notifications, so how can i create them?
Thanks for your help.
---
Update 1: I create the neccesary rule, it works now, but the bug is still exist.
Update 2: I found these rules, but they are not in the "ENTITYFORM SUBMISSION RULES" tab, but in the "Create Rules" tab.
I don't get how to use them, so i create my own rule in submission tab.
May be this would help somebody.

lunk_rat’s picture

The section "How to send the email to an email address on the Entityform" seems to refer to rule component parameter names that have changed in the latest 2.x version. I tried to follow this but did not get it to work. Please update/revise.

tedbow’s picture

@lunk_rat yes this document needs to be updated for 2.x . Maybe there should be two pages one for 1.x and one for 2.x now.

I don't have time to do this right but it would be great if someone could.

tilon’s picture

The form submission is working for me, but the problem are the files. The url or any other format doesn't appear in the email. Do you know If I need to do an extra implementation in rules to open the file and then put the url in the email?

Drupal experts in Argentina! www.tilon.com.ar

aronne’s picture

Change module bro

tedbow’s picture

Entity to Text tries to convert the output of the Entityform Submission View Mode into plain text.

This will not work with all field types. Please check the Entity To Text issue queue and file an issue there.

The other option is to just edit the notification Rule and use the field tokens in the email body, instead of the Entity To Text token.

featherbelly’s picture

Anyone got anything to add on this? I'm trying various combinations of mimemail, entityforms and rules to try and get a file attachment in the email.

This is just the kind of thing that you would expect to be straightforward... But proving not to be simple at all!

I guess you would expect having file attachments in emails to be a common request and easily fulfilled.

Any ideas how to approach this?

featherbelly’s picture

Here is a some more detailed guidance on how to solve this:

You will need to download and set up Mime Mail.

The latest version of Entity Form - currently 7.x-2.0-rc1 - comes with it's own preconfigured rules. You'll need the Entity Rules module for these. You can clone or edit these.

Alternatively you can set up your own fresh rules in the 'normal' way by using the 'After saving a new entityform submission' event.

Whichever method you go for you will need to add the 'Send HTML e-mail' element to the Actions stage of the rule (you can remove the existing actions if you cloned the packaged entity rules).

Edit the action and within the attachments section you can add a file path token, e.g.

[entity:THE_FILE_FIELD_NAME:file:path]

Check the Replacement Patterns for the field name and make sure you use 'file:path' as above and you will get an attachment on the HTML email.

Other file tokens include:

[entity:THE_FILE_FIELD_NAME:file]    
[entity:THE_FILE_FIELD_NAME:file:url]
[entity:THE_FILE_FIELD_NAME:file:size]

You may wish to use these in the email body for example.

Here is a list of file tokens. There are other useful tokens listed on there too.

averiz’s picture

I added
[entity:field_image:file:path]
to the attachments value.

Is there more to do? I don't even get the path printed. Its as if the value is empty.

capfive’s picture

I think with images you just need to do [entity:field_image]

in any event, make sure you have entity rules downloaded and enabled, this worked for me!

Drupal sites by Neubreed Design

capfive’s picture

This should be better documented, but your method works flawlessly!

Drupal sites by Neubreed Design

hommesreponse’s picture

Hello,

Loving the EntityForm module so far. Thanks for all your hard work on this.

I'm setting up an email rule in the Rules tab of my form and I need to translate the body and subject line. Is this possible? If I search for any of the strings in the translate interface nothing comes up. Do I have to create a language condition in the rule maybe?

Thanks in advance for any help or direction you can provide.

Cheers

Karol Haltenberger’s picture

I tried entering the field's token in direct input mode, but couldn't get it to work, but then I saw the description for the data selector.

To make entity fields appear in the data selector, you may have to use the condition 'entity has field'

This condition seemed reasonable anyway, so I added the condition (Entity: has field => Field: [the field I wanted]) to the rule and voilá, I could select the field in the rule action using the data selector (entity:field-name)

Entityforms 7.x-2.0-rc1
Entity Rules 7.x-1.0-alpha4
Entity tokens 7.x-1.6

RKopacz’s picture

This was a brilliant piece of advice, @Karol Haltenberger worked perfectly, thank you for posting this.

sanjay.soni’s picture

Hi,

I am not able to attach file field with unlimited value like need to attach multiple files in single field.

Any suggestion ?

Best Regards,
Sanjay
skype:er.sanjaysoni

nsputnik’s picture

I have a form where I capture the users' email address along with a bunch of other data but when I get the notification emails it does not have the user's address in the body. I have to go into the reports and edit the entry to get it. In it's place in the email it says "Contact person by email." Where can I change this?

nsputnik’s picture

OK, my problem was that I had selected "Email contact form" in the emaill address menu in the display setting when I should have selected "Email plain text."