Bakbak Posted October 17, 2017 Share Posted October 17, 2017 I've got a simple form to email PHP system that works just fine for me, because my webmail comes from One and they support server side email scripts. But the problem is that Hotmail does not, so my form doesn't work for emails that don't support what One does support. I've looked through the internet to find the perfect solution, but PHP is not something that I like to use so playing around with it is not my cup of tea. Incase you wonder what my PHP mail folder currently looks like, have a look: <?php $name = $_POST['name']; $lastname = $_POST['lastname']; $email = $_POST['email']; $phone = $_POST['phone']; $workshop = $_POST['workshop']; $location = $_POST['location']; $information = $_POST['information']; $contact = $_POST['contact']; if( !isset($_POST['name'])) { die("No Direct Access"); } $spam = $_POST['username']; if($spam) { die("error: Spam"); } else { } $formcontent=" Naam: $name \n\n Achternaam: $lastname \n\n Email: $email \n\n Telefoon: $phone \n\n Workshop: $workshop \n\n Locatie: $location \n\n Contacten via: $contact \n\n Extra informatie: $information"; $recipient = "[email protected]"; $subject = "Workshop klant"; $mailheader = "From: ".$_POST["email"]."\r\n"; mail($recipient, $subject, $formcontent, $mailheader) or die("Error!"); header('Location: verzonden.html'); As you can see, this is very basic stuff. That's why I came to the place where people know much much more about this than me. Thanks for taking the time. As you can see, this is very basic stuff. That's why I came to the place where people know much much more about this than me. Thanks for taking the time Quote Link to comment https://forums.phpfreaks.com/topic/305386-php-form-not-sending-to-hotmail-gmail-etc/ Share on other sites More sharing options...
Bakbak Posted October 17, 2017 Author Share Posted October 17, 2017 Ps, I've sent this from my phone, sorry if the code is not placed correctly. Quote Link to comment https://forums.phpfreaks.com/topic/305386-php-form-not-sending-to-hotmail-gmail-etc/#findComment-1552775 Share on other sites More sharing options...
requinix Posted October 17, 2017 Share Posted October 17, 2017 Making your own emails is a good way to get them sent to spam or be outright rejected by the server. Use something like PHPMailer instead. Quote Link to comment https://forums.phpfreaks.com/topic/305386-php-form-not-sending-to-hotmail-gmail-etc/#findComment-1552777 Share on other sites More sharing options...
phpmillion Posted October 17, 2017 Share Posted October 17, 2017 First of all, you didn't tell us what errors (if any) you get. Without such a vital information, nobody will be able to help you further. Second, I can't tell you enough how bad your code for mail sending is. Not only it has tons of "common sense" flaws, but it's also extremely insecure. In fact, using this code is like asking to hack you. Why don't you use an existing mailing solution like Swiftmail or similar? Quote Link to comment https://forums.phpfreaks.com/topic/305386-php-form-not-sending-to-hotmail-gmail-etc/#findComment-1552778 Share on other sites More sharing options...
mac_gyver Posted October 17, 2017 Share Posted October 17, 2017 no matter how you end up interfacing php to the sending mail server, these emails are NOT being sent from the email address that someone entered in your form. DO NOT use that entered email address as the From: address. if you use one of the suggested classes, phpmailer or swiftmailer, you can use SMTP (which is a protocol) to send the email to an email account that you 'own' (requires authenticating against the email account, with the mail box name/email address and the password.) Quote Link to comment https://forums.phpfreaks.com/topic/305386-php-form-not-sending-to-hotmail-gmail-etc/#findComment-1552781 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.