PHP Send email with PDF attachment without creating the file?

前端 未结 2 1800
太阳男子
太阳男子 2020-12-09 20:23

I generate PDF\'s using FPDF and I need to email it to a customer.

Since I can generate the PDF\'s from the DB, I don\'t want to save all the PDF\'s locally as it wi

2条回答
  •  無奈伤痛
    2020-12-09 21:08

         
    --PHP-mixed-  
    Content-Type: multipart/alternative; boundary="PHP-alt-" 
    
    --PHP-alt-  
    Content-Type: text/plain; charset="iso-8859-1" 
    Content-Transfer-Encoding: 7bit
    
    Hello World!!! 
    This is simple text email message. 
    
    --PHP-alt-  
    Content-Type: text/html; charset="iso-8859-1" 
    Content-Transfer-Encoding: 7bit
    
    

    Hello World!

    This is something with HTML formatting.

    --PHP-alt--- --PHP-mixed- Content-Type: application/zip; name="attachment.zip" Content-Transfer-Encoding: base64 Content-Disposition: attachment --PHP-mixed---

    you will notice this line $attachment = chunk_split(base64_encode(file_get_contents('attachment.zip'))); and you change to suit your in memory file.

提交回复
热议问题