Hey Guys,
I am looking for a way to get email attachments together with reply's from the server.
You fill in a webform and based upon that you recieve an email with a specific attachment in it.
I already found this script on this forum : Link
I tweaked it a little bit and came up with this:
<?
if ($Submit=='opslaan'){
#Voor het .nl adres
if($_POST[domein]=='nl'){
$message = "documents enclosed";
$uid = strtoupper(md5(uniqid(time())));
$headers = "From: joe@joe.net\nReply-To: joe@joe.net\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/mixed; boundary=$uid\n";
$headers .= "--$uid\n";
$headers .= "Content-Type: text/plain\n";
$headers .= "Content-Transfer-Encoding: 8bit\n\n";
$headers .= "$message\n";
$headers .= "--$uid\n";
#$headers .= "Content-Type: ".$document[pdf]."; name=\"".$document[vrijwaringsverklaring_com]."\"\n";
$headers .= "Content-type: text/html;charset=ISO-8859-9\n";
$headers .= "Content-Type: application/pdf; name=vrijwaringsverklaring_com.pdf\r\n";
$headers .= "Content-Transfer-Encoding: base64\n";
$headers .= "Content-Disposition: attachment; filename=\"vrijwaringsverklaring_com.pdf\"\r\n";
#$headers .= stripslashes(chunk_split(base64_encode($document))) . "\r\n\r\n";
#Voor het .com formulier
}elseif($_POST[domein]=='com'){
$message = "dcouments enclosed.";
$uid = strtoupper(md5(uniqid(time())));
$headers = "From: joe@joe.net\nReply-To: joe@joe.net\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/mixed; boundary=$uid\n";
$headers .= "--$uid\n";
$headers .= "Content-Type: text/plain\n";
$headers .= "Content-Transfer-Encoding: 8bit\n\n";
$headers .= "$message\n";
$headers .= "--$uid\n";
#$headers .= "Content-Type: ".$document[document_type]."; name=\"".$document[document_name]."\"\n";
$headers .= "Content-type: text/html;charset=ISO-8859-9\n";
$headers .= "Content-Transfer-Encoding: base64\n";
$headers .= "Content-Disposition: attachment; filename=\"vrijwaringsverklaring_com.pdf\"\n\n";
#$headers .= stripslashes(chunk_split(base64_encode($document[document]))) . "\n";
#Voor het .net formulier
}elseif($_POST[domein]=='net'){
$message = "documents enclosed.";
$uid = strtoupper(md5(uniqid(time())));
$headers = "From: joe@joe.net\nReply-To: joe@joe.net\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/mixed; boundary=$uid\n";
$headers .= "--$uid\n";
$headers .= "Content-Type: text/plain\n";
$headers .= "Content-Transfer-Encoding: 8bit\n\n";
$headers .= "$message\n";
$headers .= "--$uid\n";
#$headers .= "Content-Type: ".$document[document_type]."; name=\"".$document[document_name]."\"\n";
$headers .= "Content-type: text/html;charset=ISO-8859-9\n";
$headers .= "Content-Transfer-Encoding: base64\n";
$headers .= "Content-Disposition: attachment; filename=\"vrijwaringsverklaring_com.pdf\"\n\n";
#$headers .= stripslashes(chunk_split(base64_encode($document[document]))) . "\n"; }
}
mail("joe@joe.net","test",$message,$headers);
echo "done"; }
?>
The problem I seem to have is that the attachment that arrives from the server is nothing but the name only. There is nothing inside of the pdf except some jibberish.
Can anyone give me advice on how to solve this problem? Thanks in advance.