PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

once registered an email is sent with a pdf doc

  1. jcolome
    Member

    does your form provide a way to have someone register and then send them via email a pdf document ? I don't want them to go to a redirect page to download but to receive the pdf doc via email only.

    Please advise -

    Jcolome

    Posted 13 years ago on Sunday November 21, 2010 | Permalink
  2. File attachments are not possible with the notification emails. You can provide a link to a file in the notification email, but not an actual file attachment that is included with the email itself. They would have to click a link.

    Posted 13 years ago on Monday November 22, 2010 | Permalink
  3. Hey Mate,

    GF may lack documentation, but it doesn't lack possibilities. Were I in your shoes I would redirect the user on submit to a 'thank you' type page. With a twist:

    redirect to a page that adds an attachment and emails it:

    http://pastie.org/1318403.js

    obviously you would change many variables (using header variables sent by the form, most likely). When mail is sent, simply redirect to a page of your choosing (thank you, check email, etc)

    Posted 13 years ago on Monday November 22, 2010 | Permalink
  4. I have achieved this by simply adding my own hooks into the email notification code and modifying the GFCommon::send_email method to accept an array of attachments and pass these to the wp_mail function, which supports attachments anyway.

    Within the method GFCommon::send_user_notification :

    $attachments = apply_filters("gform_user_notification_attachments_{$form_id}", $lead, $form);
    
    self::send_email($from, $to, $bcc, $reply_to, $subject, $message, $from_name, $message_format, $attachments);

    and within the method GFCommon::send_admin_notification :

    $attachments = apply_filters("gform_admin_notification_attachments_{$form_id}", $lead, $form);
    
    self::send_email($from, $to, $bcc, $reply_to, $subject, $message, $from_name, $message_format, $attachments);

    And finally within the GFCommon::send_email method:

    $result = wp_mail($to, $subject, $message, $headers, $attachments);

    In my scenario, I am generating two personalised PDF documents for them to sign and return by post (old school, I know). I am populating PDF forms by mapping my Gravity Forms to XFDF and using the command-line tool pdftk to bind the XFDF data with my PDF... saving the result(s) as tmp file(s) so that it can be attached to the email.

    Since this approach completely de-couples email attachments from your product, is this something you would look at baking into the codebase... it would certainly ease my update woes and will probably be rather useful to others too!

    Posted 12 years ago on Wednesday February 1, 2012 | Permalink
  5. Yes, attachments are definitely something we plan on looking at and i'll be sure to share your post with our development team. We've been hesitant thus far due to the fact that just like email, attachment reliability will be dependent on the server rather than Gravity Forms itself. But it is something we definitely want to implement.

    Posted 12 years ago on Thursday February 2, 2012 | Permalink
  6. Thanks for that. My stand point is that by offering a hook for developers to add an attachment, you are by no means liable for any problems which may crop up with the overhead that this may impose on the server.. and importantly you need not rush into officially supporting email attachments as part of your offering and are instead offering a helping hand to those that wish to incorporate email attachments themselves, and at their own risk. It would be great to see this in the next release - it so light-weight that I suspect it would carry little or no risk at all to the stability of Gravity Forms and by simply relying on the tried and tested Wordpress filters (which you use to manipulate the to email address anyway) - apologies if I appear pushy, I may have gotten a little over-excited about this :)

    Posted 12 years ago on Thursday February 2, 2012 | Permalink
  7. We will be adding this hook in the Gravity Forms v1.6.3 Beta 2 release which we are planning on releasing tomorrow. We are testing the hook now and it appears to be working fine.

    So keep an eye out for the Gravity Forms v1.6.3 Beta 2 release and i'll include information on this new hook in the blog post release announcement.

    The hook will be the first step as you mentioned, and then we can expand this with more advanced functionality with admin UI down the road.

    We want to completely overhaul the Notification system as it is so i'm sure we will incorporate attachment settings into the new UI when we do.

    Posted 12 years ago on Thursday February 2, 2012 | Permalink

This topic has been resolved and has been closed to new replies.