phpfreakjav Posted April 20, 2009 Share Posted April 20, 2009 http://www.hidrocultivosjc.com/form/ I am working on this form. But it will not email to yahoo.com I dont know why here is the code. <?php $works = $_POST['class']; if($works!="")//this is to trick spam bots, hidden field must be created in the form with name class. { exit(); } function email_validation($email){ $qtext = '[^\\x0d\\x22\\x5c\\x80-\\xff]'; $dtext = '[^\\x0d\\x5b-\\x5d\\x80-\\xff]'; $atom = '[^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e\\x3a-\\x3c'. '\\x3e\\x40\\x5b-\\x5d\\x7f-\\xff]+'; $quoted_pair = '\\x5c[\\x00-\\x7f]'; $domain_literal = "\\x5b($dtext|$quoted_pair)*\\x5d"; $quoted_string = "\\x22($qtext|$quoted_pair)*\\x22"; $domain_ref = $atom; $sub_domain = "($domain_ref|$domain_literal)"; $word = "($atom|$quoted_string)"; $domain = "$sub_domain(\\x2e$sub_domain)*"; $local_part = "$word(\\x2e$word)*"; $addr_spec = "$local_part\\x40$domain"; return preg_match("!^$addr_spec$!", $email) ? 1 : 0; } function clean_html($dirty_form) { foreach($dirty_form as &$val) /*most important concept *when passing an array by reference you must use & */ { $val = strip_tags($val); $val = stripslashes($val); } return $dirty_form; } /* display function purpose: to display all values inside of this x array*/ function display($xarray) { $array=$xarray; print '<ul>'; foreach($array as $val) { print '<li>'; print $val; print '</li>'; } print '</ul>'; } $avail =$_POST['datepicker'];//when will you be available to start? $avail1 =$_POST['datepicker1'];//when will you be available to start? $fname =$_POST['fname']; //first name $lname =$_POST['lname']; //last name $email =$_POST['email']; //email address $phone =$_POST['phone']; //business number $cell =$_POST['cphone']; //cell phone $saddress =$_POST['saddress']; //street address $saddress2=$_POST['saddress2']; //street address additional space $city =$_POST['city']; //city $state =$_POST['state']; //state $zipcode =$_POST['zipcode']; //zip code $available_days=array($_POST['monday'],$_POST['tuesday'],$_POST['wednesday'],$_POST['thursday'],$_POST['friday'],$_POST['saturday'],$_POST['sunday']); $available_times=array($_POST['morning'],$_POST['morning'],$_POST['afternoon'],$_POST['evenings'],$_POST['nights']); $volunteered =$_POST['volunteered'];//have you ever voluntered for this organizations $pvolunteered=$_POST['pvolunteered'];//Are there any areas you would be particularly interested in volunteering? $skills=$_POST['skills'];//Do you have any special skills / other qualifications? $decision=$_POST['decision'];//What made you decide that you would like to volunteer? $flanguage=$_POST['flanguage'];//What is your first language? Any other comments or questions? $dirty_form=array($fname,$lname,$email,$phone,$cell,$saddress,$saddress2,$city,$state,$zipcode,$available_days,$volunteered, $pvolunteered,$skills,$decision,$flanguage); /*loading all values into one array*/ $clean_form=clean_html($dirty_form);//strips html and harmfull names for the server. ?> <?php @$pfw_ip= $_SERVER['REMOTE_ADDR']; //Sending Email to form owner $headers = "From: abogados\n". "Reply-To:"; $pfw_subject = "Club de Abogados"; $pfw_email_to = "[email protected]"; $pfw_message = " <html> <head> <style type='text/css'> th{text-align:right;height:30px;} table{line-heigth:200%;} h1{paddign:0;margin:0;font-size:large;font-family:Times New Roman;} </style> </head> <body> <h1>Notary Training Contact Form</h1> <table> <tr> <th>when will you be available to start?</th> <td>$avail - $avail1 </td> </tr> <tr> <th>First Name:</th> <td>$clean_form[0] </td> </tr> <tr> <th>Last Name</th> <td>$clean_form[1]</td> </tr> <tr> <th>Phone Number</th> <td>$clean_form[2]</td> </tr> <tr> <th>Email</th> <td>$clean_form[3]</td> </tr> <tr> <th>Phone</th> <td>$clean_form[4]</td> </tr> <tr> th>Cell Phone</th> <td>$clean_form[5]</td> </tr> <tr> <th>Street Address</th> <td>$clean_form[6]</td> </tr> <tr> <th>Street Address -continued.</th> <td>$clean_form[7]</td> </tr> <tr> <th>City</th> <td>$clean_form[8]</td> </tr> <tr> <th>State</th> <td>$clean_form[8]</td> </tr> <tr> <th>zipcode</th> <td>$clean_form[9]</td> </tr> <tr> <th>Have you ever voluntered for this organizations?</th> <td>$clean_form[10]</td> </tr> <tr> <th>Do you have any special skills / other qualifications?</th> <td>$clean_form[11]</td> </tr> <tr> <th>What made you decide that you would like to volunteer?</th> <td>$clean_form[12]</td> </tr> <tr> <th>What is your first language? Any other comments or questions?</th> <td>$clean_form[13]</td> </tr> </table> </body> </html> " . display($available_days). display($available_times); $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= "From: $email\n". "Reply-To: $email\n"; $ok=@mail($pfw_email_to, $pfw_subject ,$pfw_message ,$headers ) ; ?> <?php include('thanks.php'); ?> Link to comment https://forums.phpfreaks.com/topic/154925-mail-function-not-working-i-dont-get-it-no-errors-displayed/ Share on other sites More sharing options...
rhodesa Posted April 20, 2009 Share Posted April 20, 2009 try removing the $headers from the mail() function. a lot of hosting providers don't allow you to "spoof" the from address like that. Link to comment https://forums.phpfreaks.com/topic/154925-mail-function-not-working-i-dont-get-it-no-errors-displayed/#findComment-814897 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.