On some occasions, I have been having trouble opening pdf's as email attachments (When downloading the pdf directly from the webform edit section, the file opens just fine). I cannot determine the conditions that cause this, but it has been happening with the webforms that I have created under the webform version 6.x-3.11. Perhaps webforms created under previous versions are immune to this. The bug also happens on different server environments (I was able to download a pdf attachment when it was sent from my local site as opposed to my online sites for any webform regardless of what version it was created under). I was able to find a fix to my problem based on the following article:

http://drupal.org/node/741466#comment-2752160 where the fix was to simply remove the quotes around the filename variable on the Content-Disposition: parameter during the creation of the pdf email attachment.

My solution was to change the following in line 772 in webform2pdf.module

$message['body'] .= "Content-Disposition: attachment; filename=\"" . $filename . "\"\n\n";

to

$message['body'] .= "Content-Disposition: attachment; filename=" . $filename . "\n\n";

Comments

bao truong’s picture

Status: Active » Needs review
StatusFileSize
new1.05 KB
bao truong’s picture

Please use this latest patch, it allows the filename of the pdf to be seen in the email attachment. The previous patch did not allow this because their was an extra quote that should have been removed in the Content-Disposition: attachment; filename parameter declaration" I updated the code in my previous comment to reflect this

bao truong’s picture

Issue summary: View changes

adjusting for the latest version of webfrom2pdf module 6.x-2.x-dev for the 2011-11-18, mine was for the 2010-08 release abnd it was changed since when I downloaded today

mr.york’s picture

Status: Needs review » Closed (won't fix)
mr.york’s picture

Issue summary: View changes

Update the code to reflect latest patch adjustment