Jump to content

Recommended Posts

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

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?

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.)

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.