Jump to content

[SOLVED] PHP E-mail Form


harmanUK

Recommended Posts

Hello,

 

I have been trying to create a simple PHP e-mail form, the code i have at the moment is:

 

<?php 
{
$to = "myemail@gmail.com";
$company = "Matrix Electronics LTD"; 
$subject = "New Order Notification"; 
$thanks = "New Order Notification"; 
$headerclient = "Testing";
$name = $_POST['name']; 
$email = $_POST['e-mail']; 
$item1 = $_POST['item1'];   
$item2 = $_POST['item2'];
$item3 = $_POST['item3'];
  
$body = "You have a new order\n Name: <br>$name</br>\n E-mail $email\n Item 1: $item1\n Item 2: $item2\n Item 3: $item3"; 
$bodyclient = "Thank you for your order <br>$name</br>\n\n You have ordered:\n Item 1: $item1\n Item 2: $item2\n Item 3: $item3\n Thank you for shopping at $company !";   

echo "Thank you $name_field, your order has been received at $company! You will receive a confirmation e-mail to $email shortly. "; 
mail($to, $subject, $body, $headerclient); 
mail($email, $thanks, $bodyclient, $headerclient); 
} 
?> 

 

It works and sends the e-mail's but how to i define who it is from, at the moment when i receive the e-mail its from steadyne@srv2.thewebhostserver.com. How can i change that to the company name?

 

Thanks,

Terry

Link to comment
Share on other sites

Well when you send an email you have to specify certain headers, which is basically just a email form of a file's metadata... you mistakenly set yours to "testing" which is why I'm surprised it didn't get blocked as spam.

 

Try changing the value of your header variable from "testing" to whatever form matches what you want from my last post.

Link to comment
Share on other sites

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.