Met variabelen $d, $u, $e werkt onderstaande code niet meer. Als ik het hardgecodeerd maak wel. Waardoor wordt dit veroorzaakt? Ik heb het variabel nodig.
PHP:
<?php
$d = $_GET['p'];
$u = $_GET['u'];
$email_to = $_GET['e'];
$email_from = "no-reply@mydomain.com";
$headers = "From: " . $email_from;
$fileatt = "$d/c_2011.pdf";
$fileatt_type = "application/pdf";
$fileatt_name = "$d/c_2011.pdf";
$email_subject = "Your 2011 c17:51";
$email_message = "Dear $u,<br /><br /> Thanks for visiting mydomain.com! Here is your 2011 c as attached pdf file din-A4.<br /> Thanks for visiting.<br />";
$file = fopen($fileatt,'rb');
$data = fread($file,filesize($fileatt));
fclose($file);
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
$headers .= "\nMIME-Version: 1.0\n" .
"Content-Type: multipart/mixed;\n" .
" boundary=\"{$mime_boundary}\"";
$email_message .= "This is a multi-part message in MIME format.\n\n" .
"--{$mime_boundary}\n" .
"Content-Type:text/html; charset=\"iso-8859-1\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" .
$email_message .= "\n\n";
$data = chunk_split(base64_encode($data));
$email_message .= "--{$mime_boundary}\n" .
"Content-Type: {$fileatt_type};\n" .
" name=\"{$fileatt_name}\"\n" .
//"Content-Disposition: attachment;\n" .
//" filename=\"{$fileatt_name}\"\n" .
"Content-Transfer-Encoding: base64\n\n" .
$data .= "\n\n" . "--{$mime_boundary}--\n";
$ok = @mail($email_to, $email_subject, $email_message, $headers);
if($ok)
{
echo "Dear $u,<br /><br />Your c has been sent. Please both check your mail and spambox the next 24 hours.<br /><br />Once again, thanks for your order.<br /><br />The mydomain sales team";
}
else
{
die("Sorry but the email could not be sent. Please go back and try again!");
}
?>
Laatst bewerkt door een moderator: