0

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?

1

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 & 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.

|improve this answer|||||
  • Thanks 'featherbelly' for your comment. I followed your directions, and regardless what I do, the file is not being attached in the email. I only see the "Attached File:" label in the email but no attachment. I installed the mime mail module, I added the 'Send HTML e-mail' action and I see the 'attachment field' in the action, I am adding the correct token but the file is not being attached to the email sent. Any ideas you can help of what might be wrong here. Thank you. – Boutros AbiChedid Mar 30 '15 at 20:10
  • I've added some trouble shooting tips to my original answer. Good luck! – featherbelly Apr 2 '15 at 14:02
0

Here the two modules which can help you sending HTML mails

  1. Mimemail

Provides simple system actions and Rules actions to send HTML email with embedded images and attachments.

2 Rules

It will allow you to send html mail as action on event of your entityform submission.

|improve this answer|||||
  • I already have Mimemail and Rules modules installed. The issue I have is that I don't know what needs to be done to get an attachment sent as part of the email. What needs to be done is not intuitive. I don't care about the email style (text email is fine with me) as long I get the attachment as part of the email. What are the instructions to send an attachment? Thanks. – Boutros AbiChedid Jan 10 '15 at 23:46

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.