terabitez Posted January 7, 2007 Share Posted January 7, 2007 hi, My php mails are sent to yahoo's bulk folder. here's my code:<?php $form_block = " <form method=\"post\" action=\"$_SERVER[PHP_SELF]\"> <font color=red>(*)Required fields</font><br />"; $form_block.="$err_message <br />"; $form_block.="*First Name: <input name=\"fname\" type=\"text\" /><br /><br /> *Last Name: <input name=\"lname\" type=\"text\" /><br /><br /> *Email: <input name=\"email\" type=\"text\" /><br /><br /> *Subject: <input type=\"text\" name=\"subject\" size =\"42\"/><br/><br /> *Message:<br /> <textarea name=\"message\" rows=\"15\" cols=\"40\"> </textarea><br /> <input type=\"submit\" value=\"Send\" name=\"send\"/> <input type=\"reset\" value=\"Reset this form\" name=\"reset\" /> <input type=\"hidden\" name=\"op\" value=\"sent\" /> </form>"; if($_POST[op]!="sent") { print "$form_block"; } else if($_POST[op]=="sent") { $email = $_REQUEST['email'] ; $message = $_REQUEST['message'] ; $subject = $_REQUEST['subject']; $fname = $_REQUEST['fname']; $lname = $_REQUEST['lname']; if($fname == "") { $err_fname = "<font color=red><b> Please enter your first name.</b></font>"; $send = "no"; } if($lname == "") { $err_lname = "<font color=red><b> Please enter your last name.</b></font>"; $send = "no"; } if($message == "") { $err_message = "<font color=red><b> Please enter your message.</b></font>"; $send = "no"; } if($subject == "") { $err_subject = "<font color=red><b> Please enter a subject.</b></font>"; $send = "no"; } if($email == "") { $err_email = "<font color=red><b> Please enter your email.</b></font>"; $send = "no"; } if($send != "no"){ $mailheader = "From: \"$fname $lname\" <$email> \r\n"; $mailheader .= "Reply-To: \"$fname $lname\" <$email> \r\n"; $mailheader .="X-Mailer: PHP/" . phpversion() ; mail( "[email protected]", $subject, $message, $mailheader); //header( "Location: $_SERVER[PHP_SELF]" ); print "Thank you $fname for your email."; } else if ($send == "no"){ print "$err_fname\n"; print "$err_lname\n"; print "$err_email\n"; print "$err_subject\n"; print "$err_message\n"; print "<br />$form_block"; } } ?> please help..... :) Quote Link to comment https://forums.phpfreaks.com/topic/33182-php-mail-sent-to-bulk-folder/ Share on other sites More sharing options...
Jessica Posted January 7, 2007 Share Posted January 7, 2007 It's probably the content of the mail. Quote Link to comment https://forums.phpfreaks.com/topic/33182-php-mail-sent-to-bulk-folder/#findComment-154861 Share on other sites More sharing options...
terabitez Posted January 7, 2007 Author Share Posted January 7, 2007 well, I'm getting spaces on the textarea so that the message cursor points to the second line (indented) but I dont't know if my code affects the textarea for some reason. see: http://www.gcfsouth.com/feedback.php Quote Link to comment https://forums.phpfreaks.com/topic/33182-php-mail-sent-to-bulk-folder/#findComment-154870 Share on other sites More sharing options...
alpine Posted January 7, 2007 Share Posted January 7, 2007 A lot of those bulk issues can be avoided by providing som proper headers in the message.A lot of questions is regarding this exact problem, so i'll provide an example of a setup that should improve this - study it:[code]<?php// $your_sitename = "here";// $your_sitemail = "[email protected]";// $recipient = $_POST['recipient']; // or a static one ofcourse// $subject = $_POST['message']; // or a static one// $message = $_POST['message'];$naughty = "/(%0A|%0D|\\n+|\\r+)(content-type:|mime-version:|cc:|bcc:)/i";if(preg_match($naughty, $subject) || preg_match($naughty, $recipient)){ die("Sorry, injection attempt blocked!");}if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $recipient)){ die("Not a valid email adress was provided");}$eol = "\r\n";$headers = "From: $your_sitename <$your_sitemail>".$eol;$headers .= "Reply-To: $your_sitename <$your_sitemail>".$eol;$headers .= "Return-Path: $your_sitename <$your_sitemail>".$eol;$headers .= "X-Mailer: PHP v".phpversion().$eol;$headers .= "Date: ".date("r").$eol;$headers .= "Message-ID: <".date("YmdHis").substr(md5(rand()),12)."@".$_SERVER['SERVER_NAME'].">".$eol;$mime_boundary = md5(time());$headers .= 'MIME-Version: 1.0'.$eol;$headers .= "Content-Transfer-Encoding: 8bit".$eol;$headers .= "Content-Type: multipart/related; boundary=\"".$mime_boundary."\"".$eol;$msg = "";$msg .= "--".$mime_boundary.$eol;$msg .= "Content-Transfer-Encoding: 8bit".$eol;$msg .= "Content-Type: text/plain; charset=iso-8859-1".$eol; // <-- modify charset to suit$msg .= $eol.$eol.$message.$eol.$eol;$msg = wordwrap($msg, 70);if(ini_get('safe_mode')){mail($recipient, $subject, $msg, $headers);}else{mail($recipient, $subject, $msg, $headers, "-f" . $your_sitemail);}?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/33182-php-mail-sent-to-bulk-folder/#findComment-154893 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.