Attach to email a PDF generated by FPDF script

I’m using FPDF to generate PDFs from data and it’s working perfectly. I now want to send a generated PDF as an attachment in an email.

What’s the method for doing this? The PDF is an invoice so I’ve tried putting this in the attachment:

/invoice.php?output=email&inv={{InvoiceID}}

but it’s giving me this 500 error:

message: "fopen(/home/public_html/invoice.php?output=email&inv=5): failed to open stream: No such file or directory"

The PHP script is definitely in that location so I’m thinking I’m going about this the wrong way.

Is anyone able to offer some help?

Community Page
Last updated: