Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP Email From Supplied Address
    primarykey
    data
    text
    <p>I have this PHP script I don't have much experience but I supply a email from, I want the email to be sent with that email address, it now uses the email address of my webhost account... what do I have to change?</p> <pre><code>&lt;?PHP $ai_to = urldecode($_GET['to']); $ai_from = urldecode($_GET['fr']); $ai_su = urldecode($_GET['su']); $ai_bo = str_replace("CRLF","\n", urldecode($_GET['bo'])); $ai_fname = urldecode($_GET['fi']); $ai_fpath = $ai_fname; $header = "From: " . 'aiapis mail svc:' . " &lt;" . $ai_from . "&gt;\r\n"; $header .= "Reply-To: " . $ai_from . "\r\n"; if ($ai_fname != '') { $data = file_get_contents('php://input'); if (file_put_contents($ai_fpath, $data) === FALSE) die("Upload failed, sen cancelled."); $file_size = filesize($ai_fpath); if ($file_size &gt; 10485760) die("&gt; 10MB. Send cancelled."); $emtemp = 'emailtemp.log'; $current = file_get_contents($emtemp); $current .= gmdate("Y-m-d\TH:i:s") . ", " . $ai_fname . ", " . round($file_size/1048576, 3) . "MB\n"; file_put_contents($emtemp, $current); $handle = fopen($ai_fpath, "r"); $content = fread($handle, $file_size); fclose($handle); $content = chunk_split(base64_encode($content)); $uid = md5(uniqid(time())); $header .= "MIME-Version: 1.0\r\n"; $header .= "Content-Type: multipart/mixed; boundary=\"".$uid."\"\r\n\r\n"; $header .= "This is a multi-part message in MIME format.\r\n"; $header .= "--".$uid."\r\n"; $header .= "Content-type:text/plain; charset=iso-8859-1\r\n"; $header .= "Content-Transfer-Encoding: 7bit\r\n\r\n"; $header .= $ai_bo."\r\n\r\n"; $header .= "--".$uid."\r\n"; $header .= "Content-Type: application/octet-stream; name=\"".$ai_fname."\"\r\n"; $header .= "Content-Transfer-Encoding: base64\r\n"; $header .= "Content-Disposition: attachment; filename=\"".$ai_fname."\"\r\n\r\n"; $header .= $content."\r\n\r\n"; $header .= "--".$uid."--"; $sent = mail($ai_to, $ai_su, "", $header); } else $sent = mail($ai_to, $ai_su, $ai_bo, $header); if ($sent) { if ($ai_fname != '') { unlink($ai_fpath); echo "Email+attachment sent."; } else echo "Email sent."; } else echo "Mail server rejected email."; ?&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.
 

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