When I do an attachment, I could see additionally “ATT00407.txt” is getting attached along with this email which is empty. Please look into this issue. This is reflected only in the outlook
my code is :
$headers = "From: $from_name < $from_email >";
$email_txt ='';
$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_txt . "\n\n";
$fileatt = $_FILES['userfile']['tmp_name'];
$fileatt_type = $_FILES['userfile']['type'];
$fileatt_name = $_FILES['userfile']['name'];
$data = file_get_contents($_FILES['userfile']['tmp_name']);
$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";
$attachment = $_FILES['userfile']['tmp_name'];
$ok = mail($key, $email_subject, $email_message, $headers);
please help me fixing this problem
Regards