skippy111 Posted February 11, 2008 Share Posted February 11, 2008 Hi Guys, I have used a snippet of code all over the web on all my websites. I signed up last night with cyberultra hosting. I have used them in the past and the php code I have used always worked there but now it does not. I have a business website and I like to see when its visited via being sent an email which includes ip address of the visitor. I have always used a php file to do this via loading the php file with iframe flash etc. I am being told they updated security and being told about From headers and they dont know why it wont work. It has worked all over but will not work now. Can anyone offer a potential solution ? I also have a form that sends mail but is not sending as it always has. I have used this code with success <?php $email = "[email protected]"; $continue = "http://www.yahoo.com"; $subject = "Someone with this IP viewed the site"; $message = "From: $name\nEmail address: $formemail\n\n$comments\n\n-\nmy site 2008 \n-------"; $headers = "From: " . $formemail . "\n" . "Return-Path: " . $formemail . "\n" . "Reply-To: " . $formemail . "\n". $_SERVER['REMOTE_ADDR']."\n"; mail($email,$subject,$message,$headers); ?> this has worked on every host I ever used but now it will not work at my current host. They are not providing much help at all. What changes can be made to comply with the from header suggestion they claim to be the problem ? Thanks Link to comment https://forums.phpfreaks.com/topic/90537-advise/ Share on other sites More sharing options...
revraz Posted February 11, 2008 Share Posted February 11, 2008 There is nothing wrong with that FROM: header, unless $formemail is empty. Link to comment https://forums.phpfreaks.com/topic/90537-advise/#findComment-464164 Share on other sites More sharing options...
skippy111 Posted February 11, 2008 Author Share Posted February 11, 2008 this is there latest reply I guess I am not sure wht they are asking Hello, We have done some security updates recently. Could you please confirm whether this is using a From: header from a valid e-mail address on your account? Link to comment https://forums.phpfreaks.com/topic/90537-advise/#findComment-464167 Share on other sites More sharing options...
rhodesa Posted February 11, 2008 Share Posted February 11, 2008 Yeah, sometimes places will make you use a FROM address that is recognized by them. Set up an email account like [email protected] and set the FROM header to that. Or just leave out the FROM header, and it will come from the PHP process. mail($email,$subject,$message); Link to comment https://forums.phpfreaks.com/topic/90537-advise/#findComment-464168 Share on other sites More sharing options...
revraz Posted February 11, 2008 Share Posted February 11, 2008 I wouldn't omit it unless you have it set right in the php.ini Link to comment https://forums.phpfreaks.com/topic/90537-advise/#findComment-464175 Share on other sites More sharing options...
skippy111 Posted February 11, 2008 Author Share Posted February 11, 2008 I tried removing it but still did not send the mail Link to comment https://forums.phpfreaks.com/topic/90537-advise/#findComment-464176 Share on other sites More sharing options...
rhodesa Posted February 11, 2008 Share Posted February 11, 2008 All the hosting services I have dealt with always had the default from already set in the php.ini Have you tried using an email account from the same domain? Link to comment https://forums.phpfreaks.com/topic/90537-advise/#findComment-464179 Share on other sites More sharing options...
skippy111 Posted February 11, 2008 Author Share Posted February 11, 2008 no but that is what I am going to try lets say I make [email protected] exactly how would I edit above code ? I really appreciate this help guys Link to comment https://forums.phpfreaks.com/topic/90537-advise/#findComment-464181 Share on other sites More sharing options...
revraz Posted February 11, 2008 Share Posted February 11, 2008 $headers = "From: [email protected]"; If that works, then you can add the rest. Link to comment https://forums.phpfreaks.com/topic/90537-advise/#findComment-464188 Share on other sites More sharing options...
skippy111 Posted February 11, 2008 Author Share Posted February 11, 2008 I am getting lost with syntax errors I guess im screwing up adding [email protected] in the original code i posted. Link to comment https://forums.phpfreaks.com/topic/90537-advise/#findComment-464222 Share on other sites More sharing options...
revraz Posted February 11, 2008 Share Posted February 11, 2008 $email = "[email protected]"; $continue = "http://www.yahoo.com"; $subject = "Someone with this IP viewed the site"; $message = "From: $name\nEmail address: $formemail\n\n$comments\n\n-\nmy site 2008 \n-------"; $headers = "From: [email protected]"; mail($email,$subject,$message,$headers); Link to comment https://forums.phpfreaks.com/topic/90537-advise/#findComment-464223 Share on other sites More sharing options...
skippy111 Posted February 11, 2008 Author Share Posted February 11, 2008 its still not sending mail. I just dont understand why. Ive tried everything here is my contact form that I have never had a problem with before and its not working either. It acts like it is but no mail sent. <?php $valid_ref1="http://www.mysite.com/contact.html"; $valid_ref2="http://www.mysite.com/contact.html"; $replyemail="[email protected]"; //clean input in case of header injection attempts! function clean_input_4email($value, $check_all_patterns = true) { $patterns[0] = '/content-type:/'; $patterns[1] = '/to:/'; $patterns[2] = '/cc:/'; $patterns[3] = '/bcc:/'; if ($check_all_patterns) { $patterns[4] = '/\r/'; $patterns[5] = '/\n/'; $patterns[6] = '/%0a/'; $patterns[7] = '/%0d/'; } //NOTE: can use str_ireplace as this is case insensitive but only available on PHP version 5.0. return preg_replace($patterns, "", strtolower($value)); } $name = clean_input_4email($_POST["name"]); $email = clean_input_4email($_POST["email"]); $thesubject = clean_input_4email($_POST["thesubject"]); $themessage = clean_input_4email($_POST["themessage"], false); $Phone = clean_input_4email($_POST["Phone"]); $error_msg='ERROR - not sent. Try again.'; $success_sent_msg='<p align="center"><strong> </strong></p> <p align="center"><strong>Your message has been successfully sent to us<br> </strong> and we will reply as soon as possible.</p> <p align="center">A copy of your message has been sent to you.</p> <p align="center">Thank you for contacting us.</p>'; $replymessage = "Hi $name Thank you for your email. We will reply to you shortly. Please DO NOT reply to this email. Below is a copy of the message you submitted: -------------------------------------------------- Name: $name Email: $email Phone: $Phone Subject: $thesubject Message: $themessage -------------------------------------------------- Thank you"; // email variable not set - load $valid_ref1 page if (!isset($_POST['email'])) { echo "<script language=\"JavaScript\"><!--\n "; echo "top.location.href = \"$valid_ref1\"; \n// --></script>"; exit; } $ref_page=$_SERVER["HTTP_REFERER"]; $valid_referrer=0; if($ref_page==$valid_ref1) $valid_referrer=1; elseif($ref_page==$valid_ref2) $valid_referrer=1; if(!$valid_referrer) { echo "<script language=\"JavaScript\"><!--\n alert(\"$error_msg\");\n"; echo "top.location.href = \"$valid_ref1\"; \n// --></script>"; exit; } $themessage = "Name: $name\nEmail: $email\nPhone: $Phone\nMessage: $themessage"; mail("$replyemail", "$thesubject", "$themessage", "From: $email\nReply-To: $email"); mail("$email", "Receipt: $thesubject", "$replymessage", "From: $replyemail\nReply-To: $replyemail"); echo $success_sent_msg; echo"<div align=\"center\"><a href=\"index.html\">Home</a></div>" .""; ?> Link to comment https://forums.phpfreaks.com/topic/90537-advise/#findComment-464230 Share on other sites More sharing options...
revraz Posted February 11, 2008 Share Posted February 11, 2008 Because you are trying to set the FROM: header to their email, you can't do that apparently. Link to comment https://forums.phpfreaks.com/topic/90537-advise/#findComment-464231 Share on other sites More sharing options...
skippy111 Posted February 11, 2008 Author Share Posted February 11, 2008 but this dont work either and its using my email at the same domain $email = "[email protected]"; $continue = "http://www.yahoo.com"; $subject = "Someone with this IP viewed the site"; $message = "From: $name\nEmail address: $formemail\n\n$comments\n\n-\nmy site 2008 \n-------"; $headers = "From: [email protected]"; mail($email,$subject,$message,$headers); everything that usualy works is failing so what is a sure fire way just for testing purposes to get this host im using to send me a test mail using php ? Nothing seems to work Link to comment https://forums.phpfreaks.com/topic/90537-advise/#findComment-464233 Share on other sites More sharing options...
rhodesa Posted February 11, 2008 Share Posted February 11, 2008 That is something you need to work out with your host then. They seem to be a bit over protective if that script won't even send. One last check. In a new, clean PHP file, put the code: <?php $to = "[email protected]"; //Set to your Yahoo email address $from = "[email protected]"; //Set to a REAL email address from your domain $subject = "Test email"; $message = "Email body"; $headers = "From: $from"; mail($email,$subject,$message,$headers) or die("Couldn't send email"); print "Done"; ?> Also, out of curiosity, who is your hosting company? Link to comment https://forums.phpfreaks.com/topic/90537-advise/#findComment-464237 Share on other sites More sharing options...
revraz Posted February 11, 2008 Share Posted February 11, 2008 Ask them to tell you exactly what it needs to be, and then have them test it. Do you have a error log? If so, the errors should be in there for why it's not sending. so what is a sure fire way just for testing purposes to get this host im using to send me a test mail using php ? Nothing seems to work Link to comment https://forums.phpfreaks.com/topic/90537-advise/#findComment-464241 Share on other sites More sharing options...
skippy111 Posted February 11, 2008 Author Share Posted February 11, 2008 "Couldn't send email " unreal edited to my yahoo and to my domain email just as you asked the host is cyberultra I have used them and all of the above scripts as recently as last year. Never a problem. I have talked to 6 different people today and still no solution Link to comment https://forums.phpfreaks.com/topic/90537-advise/#findComment-464261 Share on other sites More sharing options...
skippy111 Posted February 11, 2008 Author Share Posted February 11, 2008 from a level 2 tech Hello, I believe the problem here lies in the mail aspect of your script. The server had a backed up queue full of mail to yahoo and your messages were not able to get through. I have cleared these emails and now the server is able to send mail to your yahoo account again. Please let us know if you need any further assistance. still has not fixed the problem Link to comment https://forums.phpfreaks.com/topic/90537-advise/#findComment-464275 Share on other sites More sharing options...
revraz Posted February 11, 2008 Share Posted February 11, 2008 Try it on a non yahoo account. Nothing much we can help you with, seems to be with your Host. Link to comment https://forums.phpfreaks.com/topic/90537-advise/#findComment-464277 Share on other sites More sharing options...
skippy111 Posted February 11, 2008 Author Share Posted February 11, 2008 yeh I know. Thanks for all the input I just had ro ruleout it was not bad code. Link to comment https://forums.phpfreaks.com/topic/90537-advise/#findComment-464289 Share on other sites More sharing options...
skippy111 Posted February 12, 2008 Author Share Posted February 12, 2008 I was able to get the scripts up and running using a different email. I was also able to get the scripts to send to yahoo but not the address I wanted it to send to. Very strange. The yahoo mail has an underscore [email protected] no matter what I try it will not send to that mail. When I try to send to a yahoo name with no underscore it seems to work fine. Any ideas what might be going on here ? Link to comment https://forums.phpfreaks.com/topic/90537-advise/#findComment-464512 Share on other sites More sharing options...
rhodesa Posted February 12, 2008 Share Posted February 12, 2008 Have you tried any other Yahoo emails with an underscore? I would very much doubt the underscore is causing a problem. More likely, your email got flagged, and they are blocking email being sent to it. Link to comment https://forums.phpfreaks.com/topic/90537-advise/#findComment-464601 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.