Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This is a little sloppy. I wrote it / mashed it together a long time ago from code I found online, and might have broken it sitting here pulling out private info without my glasses on. :-) Things I learned doing this way back then: chunk_split, concatenation (.), The use of a random separator.</p> <pre><code>&lt;? $to="x"; // For the file to be sent. $from="xx"; // For the from line on the received email $name="name.ext"; $type="application/x-gzip"; $subject="subj" $mime_boundary="==Multipart_Boundary_x".md5(mt_rand())."x"; // open the file for a binary read $file = fopen(**xxxxxxxxxx filepath xxxxxxxxxxxx**,'rb'); // read the file content into a variable // $data = chunk_split(base64_encode(fread($file,filesize($file)))); // now we encode it and split it into acceptable length lines //ALREADY DONE, MOVE UP A FEW LINES // message body $message = "Here's that File I promised you"; // build headers $headers = "From: ".$from." \r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: multipart/mixed;\r\n" . " boundary=\"{$mime_boundary}\""; // put message body in mime boundries $message = "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type: text/plain; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $message . "\n\n"; // attachment with mime babble $message .= "--{$mime_boundary}\n" . "Content-Type: {$type};\n" . " name=\"{$name}\"\n" . //"Content-Disposition: attachment;\n" . //" filename=\"{$backfile}\"\n" . "Content-Transfer-Encoding: base64\n\n" . chunk_split(base64_encode(fread($file,filesize(**xxxxxxxxxx filepath xxxxxxxxxxxx**)))) . "\n\n" . "--{$mime_boundary}--\n"; // close the file fclose($file); // send mail mail($to, $subject, $message, $headers) ?&gt; </code></pre>
    singulars
    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.
    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