PDA

View Full Version : send job form to email directly


hussam81
11-14-2012, 04:30 PM
I found this script for send form data to email address with attachment: which value must be replaced to make this script work fine
the idea of my form is when preesed submit then the data send to email like :cv@site.com
with file attachment as a c.v
and user see "thanks your data has been sent"
<?php
// get posted data into local variables
$EmailTo = "email@site.com";
$Subject = "A new file was uploaded!";
$email = Trim(stripslashes($_POST['email']));
$comments = Trim(stripslashes($_POST['comments']));
$name=$_POST['name'];
$mobile=$_POST['mobile'];
$email=$_POST['email'];
$date=$_POST['date'];
$country=$_POST['country'];
$city=$_POST['city'];
$RadioGroup3=$_POST['RadioGroup3'];
$file=file_get_contents($_FILES['file']['name']);
$typeofjob=$_POST['RadioGroup1'];
// prepare email body text
$Body .= "الاسم: ";
$Body .= $name;
$Body .= "\n";
$Body .= "الايميل: ";
$Body .= $email;
$Body .= "\n";
$Body .= "الدوله: ";
$Body .= $country;
$Body .= "\n";
$Body .= "المدينه: ";
$Body .= $city;
$Body .= "\n";
$Body .= "الجوال: ";
$Body .= $mobile;
$Body .= "\n";
$Body .= "تاريخ الميلاد: ";
$Body .= $date;
$Body .= "\n";
$Body .= "الوظيفه: ";
$Body .= $RadioGroup3;
$Body .= "\n";
// ==============
// Configuration
// ==============
$uploaddir = "c:\upldr/";
// Where you want the files to upload to
//Important: Make sure this folders permissions is 0777!
$allowed_ext = "jpg, JPG, jpeg, gif, docx,doc,txt, pdf";
// These are the allowed extensions of the files that are uploaded
$max_size = "10485760";
// 50000 is the same as 50kb
$max_height = "6000";
// This is in pixels - Leave this field empty if you don't want to upload images
$max_width = "6000";
// This is in pixels - Leave this field empty if you don't want to upload images
// Check Entension
$extension = pathinfo($_FILES['file']['name']);
$extension = $extension[extension];
$allowed_paths = explode(", ", $allowed_ext);
for($i = 0; $i < count($allowed_paths); $i++) {
if ($allowed_paths[$i] == "$extension") {
$ok = "1";
}
}
// Check File Size
if ($ok == "1") {
if($_FILES['file']['size'] > $max_size)
{
print "<meta http-equiv=\"refresh\" content=\"0;URL=../upload_ERROR_SIZE\">";
exit;
}
see the attachment