メールを送信したいのですが、メールを送信しようとしていますが、問題はメールがメールボックスに空になっていることです。私のコードの問題は何ですか?
$afile = $_FILES['myFile'];
//Getting info about above taken file
$fileatttype = $afile['type'];
$fileattname = $afile['name'];
$filesize=$afile['size'];
if($fileatttype=="application/octet-stream" or $fileatttype=="text/plain" or $fileatttype=="application/msword" or $fileatttype=="application/pdf")
{
$otherData="**********************Personal Details*********************\n
Position Applied For :$Position\n
First Name :$First\n
Last Name:$LastName\n
Date Of Birth :$DD-$MM-$yy\n
Correspondence Address :$Caddress1 $Caddress2 $Caddress2\n
Permanent Address :$Paddress1 $Paddress2 $Paddress2\n
Contact No(HOME):$Home\n
Mobile :$Mobile\n
E-Mail :$EMail\n
**********************Education*********************\n
Quallification :$Quallification\n
OtherCourse:$OtherCourse\n
**********************Previous Working Details*********************\n
Company Name-$WCompany1\n
Title-$WTitle1\n
CTC-$WCTC1\n
Reasons of Leaving-$WReason1\n
Company Name-$WCompany2\n
Title-$WTitle2\n
CTC-$WCTC2\n
Reasons of Leaving-$WReason2\n
Company Name-$WCompany3\n
Title-$WTitle3\n
CTC-$WCTC3\n
Reasons of Leaving-$WReason3\n
Company Name-$WCompany4\n
Title-$WTitle4\n
CTC-$WCTC4\n
Reasons of Leaving-$WReason4\n
Current CTC:$CCTC\n
Expected CTC:$ECTC\n
Notice Period Required :$NoticePeriod\n
Total no of years experience :$TotalExperience Years\n
Current Location :$Clocation\n
Preferred Location:$Plocation\n
Resume:$Resume\n
**********************Family Details*********************\n
Father / Guardian Name :$Fname\n
Father / Spouse: Occupation:$Focc\n
Kids:$Kids\n
Age of Kids:$AOK\n
";
$to="renu_activa@yahoo.co.in";
$from=$_POST['First'];
$subject=$Position;
$headers = "From: $First";
if($filesize>0)
{
$file = fopen($afile['tmp_name'],'rb');
$data = fread($file,$afile['size']);
fclose( $file );
}
//Making a random number to use afterwards with help of current time
$semi_rand = md5( time() );
//Defining the type of email as Mime email
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
//Appending to headers, telling that its multipart message with text and attachment
$headers .= "\nMIME-Version: 1.0\n" .
"Content-Type: multipart/mixed;\n" .
" boundary=\"{$mime_boundary}\"";
//The text part of message in variable $otherData with other details
$message = "This is a multi-part message in MIME format.\n\n" .
"--{$mime_boundary}\n" .
"Content-Type: text/plain; charset=\"iso-8859-1\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" .
$otherData . "\n\n";
//Encoding all the data read from file to "base64" the standard for email attachments
$data = chunk_split(base64_encode($data));
//Appending the file data to the email including the file name etc
$message .= "--{$mime_boundary}\n" .
"Content-Type: {$fileatttype};\n" .
" name=\"{$fileattname}\"\n" .
"Content-Disposition: attachment;\n" .
" filename=\"{$fileattname}\"\n" .
"Content-Transfer-Encoding: base64\n\n" .
$data . "\n\n" .
"--{$mime_boundary}--\n";
$sentmail=mail($to, $subject, $message, $headers);
if($sentmail)
{
header('location: career-with-us.php');
}
else
{
echo "Mail Not Send Successfully....";
}
}
else
{
echo "Wrong format: Please upload only PDF/DOC/DOCX/TXT file format...";
}
テキストボックスの値も添付ファイルも空ではない理由がわかりません。その完全に空です。