Re: Attach generated pdf to email as attachment

2,158 views
Skip to first unread message

BrianS

unread,
Apr 11, 2013, 7:16:41 PM4/11/13
to dom...@googlegroups.com
If your mailer support adding attachments that are strings then you can use $rendered = $dompdf->output(). This method sets the variable to the content of the PDF. So in PHPMailer you would do something like this:

$phpmailer->AddStringAttachment($dompdf->output(),'mydoc.pdf','base64','application/pdf').


On Thursday, April 11, 2013 1:38:23 PM UTC-4, Brian Barton wrote:
If I was to attach the generated pdf as an attachment with phpmailer or wordpress' wp_mail function, would I have to save it to the server first then reference the saved server file, or can I skip saving to the server and add it to the mail function by referencing a variable such as $rendered = $dompdf->output() or $dompdf->stream()?

RIT

unread,
Apr 18, 2018, 9:08:56 AM4/18/18
to dompdf
Hi just spotted BrianS reply here but I am actually stuck and haven't figured out yet how to make it works. 

I would appreciate some help, please see if this makes sense to you or if need more details. 

Diplay dompdf output inside wp_mail $body
https://stackoverflow.com/q/49895011/9414362?sem=2

Mitchell D. Miller

unread,
Apr 20, 2018, 8:13:31 PM4/20/18
to dompdf
Diplay dompdf output inside wp_mail $body
 
Email needs a text body, for mail readers that cannot understand PDF.

PDF must be an attachment. Have you read wp_mail() reference?

If you want sample code, check out my Quick Mail plugin.
Reply all
Reply to author
Forward
0 new messages