2013-01-17 2 views
0

메일을 보내고 싶지만 메일을 보내려하지만 문제는 메일 박스에있는 메일이 비어있는 것입니다. 내 코드의 문제점은 무엇입니까?메일은 보낼 수 있지만 PHP에서는 비어 있습니다.

$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="[email protected]"; 
$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..."; 
} 

비어있는 텍스트 상자 값이나 첨부 파일이 메일에 표시되지 않는 이유는 알 수 없습니다. 그것은 완전히 비어 있습니다.

답변

0

전자 메일의 본문에 대한 새 변수를 정의합니다.

$mess = 'Please check it'; 
$messa = '*****... 

난 당신이 내가 같은 문제로 고통 내 code.Again을 편집 한

$mess = 'Please check it'; 
$mess .= '*****... 
+0

을 의미 있으리라 믿고있어. –

관련 문제