PDF is created correctly. Can download it ok. but there is not attachment on the email. just a bunch of gibberish. I'm using webform 3.15. HTML mail. SMTP auth. checked all the other posts that have had this issue, it would appear that I have the latest version, so all patches appear present in new version.
hmmmm?

Comments

butteryak’s picture

Title: No attachement received, just jiggerish at end of message. » No attachement received, just jibberish at end of message.

PS. not using a custom webform PHP template

butteryak’s picture

SMTP debugging, error in the log states. Headers cannot be modified, headers already sent by SMTP module...etc.etc.....turning off SMTP does not seem to make a difference though. No error in log, but still get same result with email. No attachment, just lines and lines of characters.

butteryak’s picture

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" 
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head><meta http-equiv="Content-Type" content="text/html; 
charset=utf-8"></head>
<body class="htmlmail">
<table width="100%" border="0" cellspacing="0" cellpadding="5"><tr>
<td valign="top" align="center">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" class="htmlmail-body">

--------------567873165cf10a2dfc9421036266f7e2
Content-Type: text/plain; charset=UTF-8; format=flowed; delsp=yes
Content-Transfer-Encoding: 8bit

Submitted on Monday, February 27, 2012 - 11:12am
Submitted by user: admin
Submitted values are:

test: hello


The results of this submission may be viewed at:
<a href="xxxxxxxxxxxxx" 
title="xxxxxx</a>

--------------567873165cf10a2dfc9421036266f7e2
Content-Type: application/pdf; name="webform_submission-501-520.pdf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="webform_submission-501-520.pdf"

JVBERi0xLjYKJeLjz9MKNiAwIG9iago8PCAvVHlwZSAvUGFnZSAvUGFyZW50IDEgMCBSIC9MYXN0
TW9kaWZpZWQgKEQ6MjAxMjAyMjcxMTEyMTktMDgnMDAnKSAvUmVzb3VyY2VzIDIgMCBSIC9NZWRp

etc etc

butteryak’s picture

Turning off HTML mail solves this issue. but of course, I need HTML mail. hmmmmmm?

butteryak’s picture

well, I updated my html mail, had to install mail mime (not mimemail), and attachments now work. The only issue I have now, is that if I send attachments, the body of the email does not work. it's either body of e-mail or attachment, not both?

butteryak’s picture

If I change my settings in "Mail system" module for webform to send emails with the defaultSendMail method as apposed to HTMLmail, it works. this just means my webform submissions are not send wiht HTML template, just plain text. which is fine, I dont' need HTML mail for webform submissions, just newsletters. so got a working solution.

mr.york’s picture

Issue summary: View changes
Status: Active » Closed (works as designed)
silurius’s picture

Version: 6.x-2.3 » 7.x-4.0
Status: Closed (works as designed) » Active

Are webform2pdf and htmlmail just fundamentally incompatible? I am experiencing this issue after installing/configuring htmlmail today. It would be really useful to be able to use both together.

Edit: Here are the dblog errors.

Lines 640-657 (error points to "if ($email && $email['exclude_empty']) {"):

Notice: Undefined index: exclude_empty in webform_submission_render() (line 645 of /var/www/sites/examplesiteplatform/sites/all/modules/webform/includes/webform.submissions.inc).

  $components = $node->webform['components'];
  
  // Remove excluded components.
  if (is_array($excluded_components)) {
    foreach ($excluded_components as $cid) {
      unset($components[$cid]);
    }
    if ($email && $email['exclude_empty']) {
      foreach ($submission->data as $cid => $data) {
        // Caution. Grids store their data in an array index by question key.
        foreach ($data as $value) {
          if ($value != '') {
            // This component has a non-empty value. Continue the outer loop.
            continue 2;
          }
        }
        unset($components[$cid]);
      }
    }
  }

Notice: Undefined offset: 0 in mimemail_html_body() (line 383 of /var/www/sites/examplesiteplatform/sites/all/modules/mimemail/mimemail.inc).

Lines 373-423 (error points to "$plaintext = drupal_html_to_text($matches[0]);"):

 * The first mime part is a multipart/alternative containing mime-encoded sub-parts for
 * HTML and plaintext. Each subsequent part is the required image or attachment.
 */
function mimemail_html_body($body, $subject, $plain = FALSE, $plaintext = NULL, $attachments = array()) {
  if (empty($plaintext)) {
    // @todo Remove once filter_xss() can handle direct descendant selectors in inline CSS.
    // @see http://drupal.org/node/1116930
    // @see http://drupal.org/node/370903
    // Pull out the message body.
    preg_match('|<body.*?</body>|mis', $body, $matches);
    $plaintext = drupal_html_to_text($matches[0]);
  }
  if ($plain) {
    // Plain mail without attachment.
    if (empty($attachments)) {
      $content_type = 'text/plain';
      return array(
        'body' => $plaintext,
        'headers' => array('Content-Type' => 'text/plain; charset=utf-8'),
      );
    }
    // Plain mail with attachement.
    else {
      $content_type = 'multipart/mixed';
      $parts = array(array(
      'content' => $plaintext,
        'Content-Type' => 'text/plain; charset=utf-8',
      ));
    }
  }
  else {
    $content_type = 'multipart/mixed';

    $plaintext_part = array('Content-Type' => 'text/plain; charset=utf-8', 'content' => $plaintext);

    // Expand all local links.
    $pattern = '/(<a[^>]+href=")([^"]*)/mi';
    $body = preg_replace_callback($pattern, '_mimemail_expand_links', $body);

    $mime_parts = mimemail_extract_files($body);

    $content = array($plaintext_part, array_shift($mime_parts));
    $content = mimemail_multipart_body($content, 'multipart/alternative', TRUE);
    $parts = array(array('Content-Type' => $content['headers']['Content-Type'], 'content' => $content['body']));

    if ($mime_parts) {
      $parts = array_merge($parts, $mime_parts);
      $content = mimemail_multipart_body($parts, 'multipart/related; type="multipart/alternative"', TRUE);
      $parts = array(array('Content-Type' => $content['headers']['Content-Type'], 'content' => $content['body']));
    }
  }