Code: Select all
$fileatt = bla bla // Path to the file
$fileatt_type = "application/octet-stream"; // File Type
$fileatt_name = $_FILES['userfile']['name']; // Filename that will be used for the file as the attachment
$email_from = $_POST['name']." ".$_POST['email']; // Who the email is from
$email_subject = $_POST[applyfor];
$email_message ='
<table cellpadding="3" cellspacing="1" border="0" width="600">
<tr>
<td>Dear HR , '.$_POST[name].' has sent the Resume </td>
</tr>
<tr>
<td width="120">Name</td>
<td>'.$_POST[name].'</td>
</tr>
<tr>
<td width="120">Age</td>
<td>'.$_POST[age].'</td>
</tr>
<tr>
<td width="120">Date of Birth</td>
<td>'.$_POST[date].'/'.$_POST[month].'/'.$_POST[year].'</td>
</tr>
<tr>
<td width="120">Gender</td>
<td>'.$_POST[gender].'</td>
</tr>
<tr>
<td width="120">Nationality</td>
<td>'.$_POST[nation].'</td>
</tr>
<tr>
<td width="120">Country of Residence</td>
<td>'.$_POST[country].'</td>
</tr>
<tr>
<td width="120">Contact Telephone</td>
<td>'.$_POST[phone].'</td>
</tr>
<tr>
<td width="120">Email</td>
<td>'.$_POST[email].'</td>
</tr>
<tr>
<td width="120">Applying For</td>
<td>'.$_POST[applyfor].'</td>
</tr>
</table>
';
$email_to = 'aaaaaa@jjj.com'
//adds the e-mail address of the sender
$headers = "From: ".$_POST[email];
$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=\"utf-8\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" .
$email_message . "\n\n";
$file = fopen($fileatt,'rb');
$data = fread($file,filesize($fileatt));
fclose($file);
$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";
unset($data);
unset($file);
unset($fileatt);
unset($fileatt_type);
unset($fileatt_name);
@mail($email_to, $email_subject, $email_message, $headers);i am new to this forum . hope somebody will help me to solve my pblm. The above code is working fine . i am receiving email with attachment to the specified email id . but the pblm is along with the original attachment , i am reciving another attachment say 'ATTOOOO1.C' of size 208 B . I dont know why i am recieving tis . Pls help me to solve this . Any help is appreciated .
Thank you