Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If I completely understand what you are asking this is quite simple. I am assuming you already have the PDF generated using something like fdpf or tcpdf. In that case - simply use the following code:</p> <pre><code>&lt;?php // random hash necessary to send mixed content $separator = md5(time()); $eol = PHP_EOL; // attachment name $filename = "_Desiredfilename.pdf"; // encode data (puts attachment in proper format) $pdfdoc = $pdf-&gt;Output("", "S"); $attachment = chunk_split(base64_encode($pdfdoc)); ///////////HEADERS INFORMATION//////////// // main header (multipart mandatory) message $headers = "From: Sender_Name&lt;sender@domain.com&gt;".$eol; $headers .= "Bcc: email@domain.com".$eol; $headers .= "MIME-Version: 1.0".$eol; $headers .= "Content-Type: multipart/mixed; boundary=\"".$separator."\"".$eol.$eol; $headers .= "Content-Transfer-Encoding: 7bit".$eol; $headers .= "This is a MIME encoded message.".$eol.$eol; // message $headers .= "--".$separator.$eol; $headers .= "Content-Type: text/html; charset=\"iso-8859-1\"".$eol; $headers .= "Content-Transfer-Encoding: 8bit".$eol.$eol; $headers .= $message.$eol.$eol; // attachment $headers .= "--".$separator.$eol; $headers .= "Content-Type: application/octet-stream; name=\"".$filename."\"".$eol; $headers .= "Content-Transfer-Encoding: base64".$eol; $headers .= "Content-Disposition: attachment".$eol.$eol; $headers .= $attachment.$eol.$eol; $headers .= "--".$separator."--"; //Email message mail($emailto, $emailsubject, $emailbody, $headers); ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload