stijn0713 Posted July 15, 2012 Share Posted July 15, 2012 I've been struggling for hours! :S. I have a go daddy account, i've set up an email there and then i try a simple script : $sent = mail('stijn03@hotmail.com','test','test'); if($sent){ echo 'mail verstuurd'; } else echo 'mail niet verstuurd'; I always display 'mail verstuurd' (succesfull)... but still, when i look in my hotmail account, i see no mail :S. Can i test it locally? Because go daddy is driving me crazy with this mail thing Quote Link to comment https://forums.phpfreaks.com/topic/265717-mail/ Share on other sites More sharing options...
NomadicJosh Posted July 15, 2012 Share Posted July 15, 2012 Did you check to make sure that the mail was not going to junk mail? Quote Link to comment https://forums.phpfreaks.com/topic/265717-mail/#findComment-1361761 Share on other sites More sharing options...
darkfreaks Posted July 16, 2012 Share Posted July 16, 2012 try adding headers helps avoid it being selt to junkmail. $headers = "MIME-Version: 1.0\r\n" ."Content-Type: text/plain; charset=utf-8\r\n" ."Content-Transfer-Encoding: 8bit\r\n" ."X-Mailer: PHP/". phpversion(); $sent = mail('stijn03@hotmail.com','test','test',$headers); if($sent){ echo 'mail verstuurd'; } else echo 'mail niet verstuurd'; Quote Link to comment https://forums.phpfreaks.com/topic/265717-mail/#findComment-1361791 Share on other sites More sharing options...
stijn0713 Posted July 16, 2012 Author Share Posted July 16, 2012 it's not working... :S. - I tried to put their server like in: ini_set("SMTP", "relay-hosting.secureserver.net"); - I refer to my email account on godaddy in the header What more can i do? :s Quote Link to comment https://forums.phpfreaks.com/topic/265717-mail/#findComment-1361831 Share on other sites More sharing options...
cmgweb Posted July 16, 2012 Share Posted July 16, 2012 I use a seperate mailme.php on all my email setups...here is my page i use regularly <?php //--------------------------Set these paramaters-------------------------- $subject = 'subject Order'; // Subject of email sent to you. $emailadd = 'email@email.com'; // Your email address. This is where the form information will be sent. //$url = ''; // Where to redirect after form is processed. $req = '0'; // Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty. // --------------------------Do not edit below this line-------------------------- $text = "email title:\n\n"; $space = ' '; $line = ' '; foreach ($_POST as $key => $value) { if ($req == '1') { if ($value == '') {echo "$key is empty";die;} } $j = strlen($key); if ($j >= 20) {echo "Name of form element $key cannot be longer than 30 characters";die;} $j = 20 - $j; for ($i = 1; $i <= $j; $i++) {$space .= ' ';} $value = str_replace('\n', "$line", $value); $conc = "{$key}:$space{$value}$line"; $text .= $conc; $space = ' '; } mail($emailadd, $subject, $text, 'From: '.$emailadd.''); //echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/265717-mail/#findComment-1361973 Share on other sites More sharing options...
stijn0713 Posted July 18, 2012 Author Share Posted July 18, 2012 Thanks for the replies, but i think my php script for sending mails works perfectly. It's just about the smtp setup. when i use godaddy's smtp server, it's a bit messy and works not properly, also the scripts need to be hosted on their server in order to use the outgoing smtp server apparently. So now, i want to test the mail function also locally, like i test my script locally using WAMP (php, apache, mysql). Has anybody experience with using a locallly installed stmp that works with wamp?? Quote Link to comment https://forums.phpfreaks.com/topic/265717-mail/#findComment-1362376 Share on other sites More sharing options...
sqlnoob Posted July 18, 2012 Share Posted July 18, 2012 Hello fellow Dutchie... Have you tried this: $to ="stijn03@hotmail.com"; $subject ="Stijn zijn Contact Formulier"; $email = $_POST["fromwhosemail"]; mail($to,$subject,$message,"From: $email"); I think, it doesn't send an email, because there's no headers. Those are not optional, if my memory serves me correct they are mandatory in the mail function. Quote Link to comment https://forums.phpfreaks.com/topic/265717-mail/#findComment-1362416 Share on other sites More sharing options...
sqlnoob Posted July 18, 2012 Share Posted July 18, 2012 no wait, it is optional, nevermind http://www.w3schools.com/php/php_mail.asp Quote Link to comment https://forums.phpfreaks.com/topic/265717-mail/#findComment-1362417 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.