I am trying to send an attachment with webform and MIMEmail. It is not working. I've got an attachment set up, I've gotten the latest dev versions (and tested on the last stable versions) of both modules, I've attached a file to the webform node, and I've selected "send files as attachments".
No luck.
The email still comes through, absolutely no problem, but there are no attachments.
Comments
Comment #1
quicksketchYou may be misunderstanding this functionality. This feature doesn't send files attached to the Webform node (supposedly through FileField in your situation) in the e-mail. It sends files uploaded through file components as part of the submission.
Some related requests:
#1744870: csv file attachment
#1262096: Attachments: Handbook page on using mimemail with webform to send emails with files as attachments
Comment #2
andy.alexander commentedThrough file components? I am not understanding.
I had already read the second link you sent and thought I was doing it correctly. Do you happen to have any documentation that could explain it more clearly?
Comment #3
andy.alexander commentedSo, is there a way to have a file sent from elsewhere on submission of a form? That is pre-uploaded and not dependent on a user's upload?
Comment #4
quicksketchThere isn't a built-in feature to send a pre-configured file to be sent along with the e-mail, no. .Though a number of modules such as http://drupal.org/project/webform2pdf and http://drupal.org/project/fillpdf provide functionality like this (though these only deal with PDFs). Through custom coding, you can attach any file you want through hook_mail_alter().
Comment #5
andy.alexander commentedThese both seem to generate the file automatically - one (Webform2pdf) converts the output of the form to a PDF and then sends it. That's not what I'm looking for.
The other seems to allow you to insert information into PDFs which you then send.
The easiest way I can see to do it would be to edit webform2pdf to send any type of file - is that more or less correct? I've never modified a mail function in Drupal.
Comment #6
quicksketchI would suggest a completely custom module. If you're not comfortable with writing modules, I'd suggest hiring a developer or (if you're technically inclined) reading a book on module development for Drupal. I generally don't provide help on custom coding in the Webform issue queue.
Comment #7
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.
Comment #8
jphelan commentedAlso if anonymous users are submitting the form they need the "send arbitrary files" permission or the attachment won't be sent.
Comment #9
quicksketchThanks @jphelan. I don't generally recommend Rules for anything (it makes debugging nearly impossible), but if it works then power to you. Closing after lack of activity.