Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP mail with attachment error
    primarykey
    data
    text
    <p>I have had problem with the code below. I don't know what might be wrong, but I hope you figure this out or a simple way I can send email with attachment... When I sent a try message, it sends something like this in the headers of the message...</p> <p>--244f3f04128cb4e6797d0019662a1aaa Content-Type: application/octet-stream; name="phpStorm.txt" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="phpStorm.txt" QW1iZXIgVG93bnNlbmQNCg0KNTQzMDQ1LTE4MDIyMDEzDQowMDAwMXh3Smg1blJxU0hVTEVkVFpR TmZIRWF6SXUNCmc2bTRnTE1QOTZOMlFPVnpWckphZ0Y1cmpzZm9zTQ0KMmk0ZkFDQnVZV2MzMDlO cCFXb05kRW1EcnpWcVBi</p> <p>CODE BELOW:</p> <pre><code>&lt;?php //file attachment $strSid = md5(uniqid(time())); if($_FILES["fileAttach"]["name"] != ""){ $strFilesName = $_FILES["fileAttach"]["name"]; $strContent = chunk_split(base64_encode(file_get_contents($_FILES["fileAttach"] ["tmp_name"]))); $headers .= "--".$strSid."\n"; $headers .= "Content-Type: application/octet-stream; name=\"".$strFilesName."\"\n"; $headers .= "Content-Transfer-Encoding: base64\n"; $headers .= "Content-Disposition: attachment; filename=\"".$strFilesName."\"\n\n"; $headers .= "Content-Type: multipart/mixed; "; $headers .= $strContent."\n\n"; if(mail($to, $subject, $message, $headers)){ echo "&lt;div class=\"message_success\"&gt;Your message has successfully been sent&lt;/div&gt;";//echo 'Your message has successfully been sent'; } else { echo "&lt;div class=\"message_error\"&gt;Message failed to sent, try again&lt;/div&gt;"; } } ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    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. 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