PDF email attachments were working fine for me using whatever Drupal's default php mail pieces are. However, after switching to the smtp module my webform submissions showing up as an attached binary file which is apparently a gibberish data file spit out by smtp. If I disable the pdf email attachment I then see the form field text in the email submissions, but obviously no pdf attachment.

Any thoughts on where this combination is falling down? If I had to guess, it seems there is probably something screwy with the way smtp is disaggregating the content and attachment in order to send them to the mail server?

Thanks in advance for any ideas and feedback ... and also for the handy module! :)

- Rob

Comments

mr.york’s picture

I changed the mail header creation and it is working together with the SMTP after this. Please download the new dev version.
Please change these parts of the code and the SMTP module will be working.
SMTP.module line 551:

            // If plain/html within the body part, add it to $mail->Body.
            elseif (strpos($body_part2, 'text/html')) {
              // Clean up the text.
              $body_part2 = trim(_smtp_remove_headers(trim($body_part2)));
              // Include it as part of the mail object.
              $mail->Body = $body_part2;
              $mail->ContentType = 'multipart/mixed';
            }

New code:

            // If plain/html within the body part, add it to $mail->Body.
            elseif (strpos($body_part2, 'text/html')) {
              // Clean up the text.
              $body_part2 = trim(_smtp_remove_headers(trim($body_part2)));
              // Include it as part of the mail object.
              $mail->Body = $body_part2;
//              $mail->ContentType = 'multipart/mixed';
            }

SMTP.module line 615:

            if (!$mail->AddAttachment($file_path, $file_name)) { // , $file_encoding, $file_type);
              drupal_set_message('Attachment could not be found or accessed.');
            }

New code:

            if (!$mail->AddAttachment($file_path, $file_name, $file_encoding, $file_type)) { // , $file_encoding, $file_type);
              drupal_set_message('Attachment could not be found or accessed.');
            }

The latest webform2pdf dev version is working well for me.

mr.york’s picture

Status: Active » Closed (fixed)