Adding e2pdf attachment on emails with jet form builder forms

WordPress
8 December, 2021 22:58:23
rameeshm
Topics: 3
Messages: 6
Hi, I have forms created with jet form builder. these forms I used to prepopulate data from the current posts and update the form entries to new posts. so I cant change the forms. I have a lot of options available on form submit actions (please check the attachment to see options available), can you please tell me is there any way I can attach pdf to emails with any of these options. I would like to attach a pdf of the invoice and offers in two different forms. and I like your plugin.
8 December, 2021 23:04:21
rameeshm
Topics: 3
Messages: 6
Little more details for the above requirement:
I have tried to add a shortcode on the body of send email action. but it's not processing shortcodes. it's passing form values but not shortcodes. please check the attachment for the settings I made
8 December, 2021 23:14:54
E2Pdf
Support
Topics: 7
Messages: 3163
Hi,

Unfortunately it will not work like this as [e2pdf-attachment] shortcode requires integration from our side so the shortcodes can correctly generate PDF attachments and attach it to mails.

You can try to check Jet form hooks and generate PDF attachment manually via PHP as:

$pdf_path = do_shortcode('[e2pdf-attachment id="1" dataset="'.$post_id.'" apply="true"]');

it will return PDF path which must be connected to Jet form mail "attachments" (if any).

P.S. Keep in mind please that it could be required to remove temporary PDF attachment crated on server after mail sent.

P.P.S. We currently added the point for review to our "roadmap" to make it work out of the box. If it will be any news - we will let you know.

We remain at your service.
We would really appreciate your feedback at WordPress.org!
13 December, 2021 05:19:51
rameeshm
Topics: 3
Messages: 6
Hi,

Thank you for your support and fast response.

I have tried to work according to your answer,
But I am stuck on calling hook results, I set up call hook on form with the above code (as in attachment 1). but I didn't get any idea how I can attach the resulting pdf on send mail. there are media fields that I can add to the form but there is no option to call the hook result to that attachment(please check attachment 2). Please help me to solve this.

Thank you.
13 December, 2021 08:42:48
E2Pdf
Support
Topics: 7
Messages: 3163
Unfortunately it will not work like this. We sent you example for PHP which must be added to functions.php or as PHP Snippet to needed hook which send emails + you need to set correctly the "dataset" depending on E2Pdf Template connection which will require investigation of jetforms as E2Pdf doesn't have its native support. We are still not sure which PDFs (pages / posts) do you try to attach to emails and if you are success in export needed data with "E2Pdf" -> "Export".

So unfortunately it seems you need to hire PHP WordPress developer who have needed knowledge to build custom solution as we do not provide "free" support requests for 3rd party coding solutions and currently we do not take any paid support requests due overload. Sorry for inconvenience.

We remain at your service.
We would really appreciate your feedback at WordPress.org!
7 January, 2022 06:22:06
E2Pdf
Support
Topics: 7
Messages: 3163
The code almost okay but you need to assign correct dataset. It means that you must define correct $post_id as:

$post_id = '123';
$pdf_path = do_shortcode('[e2pdf-attachment id="1" dataset="'.$post_id.'" apply="true"]');
$attachments = array($pdf_path);
$sent = wp_mail( $to, $subject, $message, $this->get_headers(), $attachments );

OR:

$pdf_path = do_shortcode('[e2pdf-attachment id="1" dataset="123" apply="true"]');
$attachments = array($pdf_path);
$sent = wp_mail( $to, $subject, $message, $this->get_headers(), $attachments );

It must work if:
1. Your E2Pdf Template connected to "WordPress" -> "Pages" / "Post"
2. "1" - is the ID of your E2Pdf Template
2. "123" - is the Page/Post ID which belongs to Post Type to which you connected E2Pdf Template.

We remain at your service.
We would really appreciate your feedback at WordPress.org!