html mail receive of php form -


i using code php form have added fields want receive form in html format while comming in general message in mail should attached file.. not coming php code this

    <?php /** configuration options  * $email_address = email address form submissions sent  * $company_address = destination address used in contact form */ $email_address = 'info@synergywebdesigners.com'; $company_address = 'delhi, india'; // send html mail, content-type header must set $headers  = 'mime-version: 1.0' . "\r\n"; $headers .= 'content-type: text/html; charset=iso-8859-1' . "\r\n"; /** not edit below line unless comfortable php */ echo "<script>var companyaddress = '".$company_address."';</script>";  $field_rules = array(     'name' => 'required',     'email' => 'required|valid_email',     'phone' => '',     'contact_reason' => 'required',     'message' => 'required' );   $error_messages = array(     'required' => 'this field required',     'valid_email' => 'please enter valid email address' );   $error_list = '';   $fields = $_post;    if (!empty($fields)) {     //validate each of fields foreach ($field_rules $field => $rules) {     $rules = explode('|', $rules);      foreach ($rules $rule)     {         $result = null;          if (isset($fields[$field]))         {             if (!empty($rule))                 $result = $rule($fields[$field]);              if ($result === false)             {                 $field_name = ucwords(implode(' ', explode('_', $field)));                  $error_list .= "<div class='error'>$field_name: " . $error_messages[$rule] . "</div>";             }         }     } }  if (empty($error_list)) {     $subject = '[application employment] new message ' . $fields['name'] . '.';     $content = $fields['name'] . " sent message contact form:\r\n\n";     $content .= "-------\n" . $fields['message'] . "\r\n\n";     $content .= "position applied for: " . $fields['positionapplied']             . " \n\ntelephone number: " . $fields['telephonenumber']             . " \n\nmobile number: " . $fields['mobilenumber']             . " \n\nemail: " . $fields['email']             . " \n\ndate of birth: " . $fields['bday']             . " \n\ngender: " . $fields['gender']             . " \n\npermanent address: " . $fields['permanentaddress']             . " \n\ncity: " . $fields['city']             . " \n\nstate: " . $fields['state']             . " \n\npin: " . $fields['pin']             . " \n\nmarital status: " . $fields['marital_status']             . " \n\nfather name: " . $fields['fathername']             . " \n\nfather occupation: " . $fields['fatheroccupation']             . " \n\nmother name: " . $fields['mothername']             . " \n\nmother age: " . $fields['motherage']             . " \n\nmother occupation: " . $fields['motheroccupation']             . " \n\nspouse name: " . $fields['spousename']             . " \n\nspouse age: " . $fields['spouseage']             . " \n\nspouse occupation: " . $fields['spouseoccupation']             . " \n\nbrother name: " . $fields['brothername']             . " \n\nbrother age: " . $fields['brotherage']             . " \n\nbrother occupation: " . $fields['brotheroccupation']             . " \n\nsister name: " . $fields['sistername']             . " \n\nsister age: " . $fields['sisterage']             . " \n\nsister occupation: " . $fields['sisteroccupation']             . " \n\neducation qualification course1: " . $fields['educationqualificationcourse1']             . " \n\neducation qualification university1: " . $fields['educationqualificationuniversity1']             . " \n\nname of college or school: " . $fields['nameofschool1']             . " \n\neducation qualification year 1: " . $fields['educationqualificationyearfrom1']             . " \n\neducation qualification year 1: " . $fields['educationqualificationyearto1']             . " \n\neducation qualification percentage 1: " . $fields['educationqualificationclasspercentage1']             . " \n\neducation qualification specialisation1: " . $fields['educationqualificationspecialisation1']             . " \n\neducation qualification course2: " . $fields['educationqualificationcourse2']             . " \n\neducation qualification university2: " . $fields['educationqualificationuniversity2']             . " \n\nname of school2: " . $fields['nameofschool2']             . " \n\neducation qualification year 2: " . $fields['educationqualificationyearfrom2']             . " \n\neducation qualification year 2: " . $fields['educationqualificationyearto2']             . " \n\neducation qualification class percentage 2: " . $fields['educationqualificationclasspercentage2']             . " \n\neducation qualification course3: " . $fields['educationqualificationspecialisation2']             . " \n\neducation qualification specialisation 2: " . $fields['educationqualificationspecialisation2']             . " \n\neducation qualification course 3: " . $fields['educationqualificationcourse3']             . " \n\neducation qualification university 3: " . $fields['educationqualificationuniversity3']             . " \n\nname of school 3: " . $fields['nameofschool3']             . " \n\neducation qualification year 3: " . $fields['educationqualificationyearfrom3']             . " \n\neducation qualification year 3: " . $fields['educationqualificationyearto3']             . " \n\neducation qualification class percentage 3: " . $fields['educationqualificationclasspercentage3']             . " \n\neducation qualification epecialisation 3: " . $fields['educationqualificationspecialisation3']             . " \n\ncomputer proficiency package language: " . $fields['computerproficiencypackagelanguage']             . " \n\ncomputer proficiency excellent: " . $fields['computerproficiencyexcellent']             . " \n\ncomputer proficiency good: " . $fields['computerproficiencygood']             . " \n\ncomputer proficiency average: " . $fields['computerproficiencyaverage']             . " \n\nprofessional courses programe 1: " . $fields['professionalcoursesprograme1']             . " \n\nprofessional courses duration 1: " . $fields['professionalcoursesduration1']             . " \n\nprofessional courses year 1: " . $fields['professionalcoursesyear1']             . " \n\nprofessional courses organised 1: " . $fields['professionalcoursesorganisedby1']             . " \n\nprofessional courses programe 2: " . $fields['professionalcoursesprograme2']             . " \n\nprofessional courses duration 2: " . $fields['professionalcoursesduration2']             . " \n\nprofessional courses year 2: " . $fields['professionalcoursesyear2']             . " \n\nprofessional courses organised 2: " . $fields['professionalcoursesorganisedby2']             . " \n\n employment experience name address organisation 1: " . $fields['employmentexpnameaddressorganisation1']             . " \n\nemployment exp name year 1: " . $fields['employmentexpnameyearfrom1']             . " \n\nemployment exp name year 1: " . $fields['employmentexpnameyearto1']             . " \n\nemployment exp position 1: " . $fields['employmentexpposition1']             . " \n\nemployment exp location 1: " . $fields['employmentexplocation1']             . " \n\nemployment exp reason leaving 1: " . $fields['employmentexpreasonleaving1']             . " \n\nemployment exp name address organisation 2: " . $fields['employmentexpnameaddressorganisation2']             . " \n\nemployment exp name year 2: " . $fields['employmentexpnameyearfrom2']             . " \n\nemployment exp name year 2: " . $fields['employmentexpnameyearto2']             . " \n\nemployment exp position 2: " . $fields['employmentexpposition2']             . " \n\nemployment exp location 2: " . $fields['employmentexplocation2']             . " \n\nemployment exp reason leaving 2: " . $fields['employmentexpreasonleaving2']             . " \n\nemployment exp name address organisation 3: " . $fields['employmentexpnameaddressorganisation3']             . " \n\nemployment exp name year 3: " . $fields['employmentexpnameyearfrom3']             . " \n\nemployment exp name year 3: " . $fields['employmentexpnameyearto3']             . " \n\nemployment exp position 3: " . $fields['employmentexpposition3']             . " \n\nemployment exp location 3: " . $fields['employmentexplocation3']             . " \n\nemployment exp reason leaving 3: " . $fields['employmentexpreasonleaving3']             . " \n\ncurrent last salary: " . $fields['currentlastsalary']             . " \n\nreferences name 1: " . $fields['referencesname1']             . " \n\nreferences designation 1: " . $fields['referencesdesignation1']             . " \n\nreferences company name 1: " . $fields['referencescompanyname1']             . " \n\nreferences contact no 1: " . $fields['referencescontactno1']             . " \n\nreferences email id 1: " . $fields['referencesemailid1']             . " \n\nreferences name 2: " . $fields['referencesname2']             . " \n\nreferences designation 2: " . $fields['referencesdesignation2']             . " \n\nreferences company name 2: " . $fields['referencescompanyname2']             . " \n\nreferences contact no 2: " . $fields['referencescontactno2']             . " \n\nreferences email id 2: " . $fields['referencesemailid2']             . " \n\nreferences name 1: " . $fields['referencesname1']             . " \n\nfile: " . $fields['uploadfield']             . " \n\nsubmission date: " . $fields['submissiondate'] . " \n\n";        if (mail($email_address, $subject, $content, "from: " . $fields['email'] . "\r\nreply-to: " . $fields['email'] . "\r\nreturn-path: " . $fields['email'] . "\r\n"))     {          echo "<h2 class='success'>message sent</h2>";         echo "<br/><p class='success'>thank <strong>" . $fields['name'] . "</strong>, message has been submitted , contact shortly.</p>";     }     else     {          echo 'error!';     } } 

}

function required($str, $val = false) {

if (!is_array($str)) {     $str = trim($str);     return ($str == '') ? false : true; } else {     return (!empty($str)); } 

}

    function valid_email($str)     {      return (!preg_match("/^(?!(?:(?:\\x22?\\x5c[\\x00-\\x7e]\\x22?)|(?:\\x22?[^\\x5c\\x22]\\x22?)){255,})(?!(?:(?:\\x22?\\x5c[\\x00-\\x7e]\\x22?)|(?:\\x22?[^\\x5c\\x22]\\x22?)){65,}@)(?:(?:[\\x21\\x23-\\x27\\x2a\\x2b\\x2d\\x2f-\\x39\\x3d\\x3f\\x5e-\\x7e]+)|(?:\\x22(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|(?:\\x5c[\\x00-\\x7f]))*\\x22))(?:\\.(?:(?:[\\x21\\x23-\\x27\\x2a\\x2b\\x2d\\x2f-\\x39\\x3d\\x3f\\x5e-\\x7e]+)|(?:\\x22(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|(?:\\x5c[\\x00-\\x7f]))*\\x22)))*@(?:(?:(?!.*[^.]{64,})(?:(?:(?:xn--)?[a-z0-9]+(?:-[a-z0-9]+)*\\.){1,126}){1,}(?:(?:[a-z][a-z0-9]*)|(?:(?:xn--)[a-z0-9]+))(?:-[a-z0-9]+)*)|(?:\\[(?:(?:ipv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){7})|(?:(?!(?:.*[a-f0-9][:\\]]){7,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?)))|(?:(?:ipv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){5}:)|(?:(?!(?:.*[a-f0-9]:){5,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3}:)?)))?(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))(?:\\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))){3}))\\]))$/id", $str)) ? false : true; } 

writing code send mail php major pain, believe me have spent hours trying manually. working , then, oh, google thinks spam. service thinks spam. not worth time. therefore recommend using service such http://www.mailgun.com/ offers 10,000 emails month free. check out tutorial started: http://blog.mailgun.com/php-how-to-use-mailgun-efficiently/. trust me, want this.


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -