Closed (fixed)
Project:
Webform
Version:
7.x-3.18
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
14 Aug 2012 at 04:04 UTC
Updated:
13 Jun 2018 at 16:00 UTC
Jump to comment: Most recent
Hi,
I created a webform to collect subscriber name and email address. As soon as the user fills the form, I would like to send them a PDF attachment in the confirmation email. The PDF file is not something user is uploading. I tried adding the attachment in the mail.tpl file by modifying email['attachment'] variable but I believe I am not doing it right. Is this possible? Can someone please give me some hints on doing this? I am using webform 7.x-3.18.
Thanks!
Comments
Comment #1
quicksketchTry http://drupal.org/project/webformpdf.
Comment #2
quicksketchSorry I meant http://drupal.org/project/webform2pdf. http://drupal.org/project/fillpdf would probably also work.
It's possible to also do this through hook_mail_alter() in a custom module, but that's beyond the scope of the Webform issue queue.
Comment #3
abuzakaria commentedThanks for the hint for using hook_mail_alter in my custom module. That's really helpful for what I am trying to do. The other modules you listed actually generates PDF from the submission results. But I actually have to send an already existing PDF that resides in the Drupal files folder.
Once again ... Thanks!
Comment #4
jiakomo commented@abuzakaria,
it would be nice to know how you solved this, as I am trying to achieve something similar.
Comment #5
jphelan commentedThis can be done with rules. You just need the following modules:
http://drupal.org/project/mimemail (Be sure to also enable Mime Mail Action)
http://drupal.org/project/rules
http://drupal.org/project/webform_rules
Then create a new rule for "After a webform has been submitted"
Add the "Select a webform" as a condition and select your webform
Then select the mimemail "Send an HTML mail to an arbitrary mail address" action NOT the system "Send a mail to an arbitrary mail address"
You can then use tokens to send the email to an address the user submits in the form. Add your attachments in your attachments box and your all set to go.
I did it in D6 but it all of the modules have a 7.x version so it should be the same or similar in D7.
Comment #6
jphelan commentedAlso if anonymous users are submitting the form they need the "send arbitrary files" permission or the attachment won't be sent.
Comment #7
abuzakaria commentedI used the mail_alter hook with to achieve this.
NOTE: you will have to modify some of the hard coded parameters if you use this code.
Comment #8
tostinni commentedThank you abuzakaria for this snippet, also this should be used in conjunction with mimemail module as Drupal can't send attachment without it.
Comment #9
johhan commentedRegard #7:
Trying in D7, but non of the mentioned names matches, mainly in constructing the rule. Some unfathomable "The form id of the submitted form" is required. As well as "A key to identify the e-mail sent."
So, can anybody clear the steps for D7 & Webform 3 ?
Thank you very much
Comment #10
jphelan commentedI have a step by step article on it here
http://justinphelan.com/post/add-attachment-drupal-webform-confirmation-...
"A key to identify the e-mail sent." Can be anything you want, it's not important in this situation.