How to Include an ATTACHMENT to a Drupal's Entityform Submission Email? I am using the Entityform module and the Rules module for its notification .
I noticed that the email sent out when the form is submitted does not attach the PDF file as part of the email's body.

I have one field in the form that allows a user to attach a PDF file.
The email body is fine with the exception that any file attachment is not part of the email.

I also added the Mime Mail module with no success.

Does anyone know how to include an attached file as part of the email notification?
Here is some more detailed guidance on how to solve this:

As mixerowsky states you will need to download and set up Mime Mail.

The latest version of Entity Form (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_NAME:FILE_FIELD_NAME:file:path]

Check the Replacement Patterns for the correct ENTITY_NAME and FILE_FIELD_NAME and make sure you append ':file:path' as above and you will get an attachment on the HTML email.

Other file tokens include:

[ENTITY_NAME:FILE_FIELD_NAME:file]
[ENTITY_NAME:FILE_FIELD_NAME:file:url]
[ENTITY_NAME: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.



Trouble Shooting &amp; Testing

Make sure you are using the correct token. Check the replacement patterns for the correct entity name and file field, e.g. 

[ENTITY_NAME:FILE_FIELD_NAME:file:path]

Then try adding the file tokens to the email BODY to make sure that it is working correctly, e.g. Add this to the body:

Filename: [ENTITY_NAME:FILE_FIELD_NAME:file]
Filepath: [ENTITY_NAME:FILE_FIELD_NAME:file:path]
FileURL:  [ENTITY_NAME:FILE_FIELD_NAME:file:url]
Filesize: [ENTITY_NAME:FILE_FIELD_NAME:file:size]


This should output something like this in the BODY of the email:-

Filename: filename.pdf
Filepath: public://filename.pdf
FileURL:  http://website.local/system/files/filename.pdf
Filesize: 16.59 KB


If the 'filepath' is not present then there will be no attachment.

Make sure that the Drupal file system is set up correctly and files are getting saved when the entity form is submitted.

Double check your System Stream Wrappers and Token installs.

Make sure you have set up Mimemail correctly and you are receiving emails OK. Maybe set up a test using a different system (e.g. Webform) to check that file attachments are working in the first place. 

If you use the correct token then it will work - however if there is an problem with the set up of the email sending or other modules then you may not get an attachment. The chain from 'entity form' to 'email with attachment' is quite long and complex so make you test every step of the journey.