Hi,

I need to send pdfs by email.
I've downloaded the module and I don't understand how I can generate and attach the PDF.
I'm working with print module.

This is my rule:

{ "rules_generate_pdf" : {
    "LABEL" : "Generate and send PDF",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "TAGS" : [ "invoice", "teacher" ],
    "REQUIRES" : [ "rules", "rules_download", "mimemail" ],
    "ON" : { "node_update--invoice" : { "bundle" : "invoice" } },
    "IF" : [
      { "data_is" : { "data" : [ "node:field-inovice-status" ], "value" : "ok" } },
      { "entity_has_field" : { "entity" : [ "node:field-student" ], "field" : "field_mail" } }
    ],
    "DO" : [
      { "rules_download_action_generate_path" : {
          "USING" : {
            "path" : "printpdf\/[node:nid]",
            "cookie" : 1,
            "uri_scheme" : "public",
            "temporary" : 1
          },
          "PROVIDE" : { "rules_download_file" : { "rules_download_file" : "Downloaded file" } }
        }
      },
      { "rules_download_action_realpath" : {
          "USING" : { "file" : [ "rules-download-file" ] },
          "PROVIDE" : { "rules_download_file_path" : { "rules_download_file_path" : "File real path" } }
        }
      },
      { "mimemail" : {
          "key" : "invoice_[node:nid]",
          "to" : [ "node:field-student:field-mail" ],
          "subject" : "Factura [node:field-text1]",
          "body" : "Your invoice.",
          "attachments" : "[rules-download-file-path:value]",
          "language" : [ "" ]
        }
      }
    ]
  }
}

Thanks!

Comments

dromansab’s picture

Title: Send PDF by mail (print module) » How to attach a downloaded file to a mail with mimemail?
ericwongcm’s picture

I think we are both trying to do the same thing?

Did you see the issue I posted?
https://drupal.org/node/2264671

dromansab’s picture

Yes... at least the first part (generate and attach the document).
I want to send the PDF when the node is updated, and you are looking for change the "Send by mail" action provided by print module.

hanoii’s picture

Your rule seems fine realy, what's happening to you?

dromansab’s picture

The system sends the email without attachment

cgdrupalkwk’s picture

dromansab,

Can you get minemail to send attachments without using the Rules Download Module?

dromansab’s picture

I haven't try it.. How can I check it? Can you post an example, please?

Thanks

hanoii’s picture

Version: 7.x-1.0 » 7.x-2.0
Status: Active » Fixed

I just released version 2.0 with a different approach within rules, and now basically using [rules-download-file:path] on the attachments form should work.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

thomasmurphy’s picture

I am trying this approach but there is no PDF attached to the email sent, and the token [rules-download-file:path] doesn't render at all, even I attempt to display the rendered token in the body or in message. I am using the print module with WKHTML and mimemail modules,