Jump to content

need help with simple php sendmail script


Recommended Posts

Hi everyone,

 

Hopefully this will be a nice easy one for you...

 

Here is the code I am currently using:

 

<?php
$name = $_REQUEST['name'];
$email = $_REQUEST['email'];
$enquiry = $_REQUEST['enquiry'];

mail( "[email protected]", "Booking Enquiry: ", $name, $enquiry, "From: $email" );

?>

 

This works but when the mail comes through it says it is from: [email protected]

 

Also I would like in the subject box for Booking Enquiry: $name (the persons name) to appear.

 

Can anyone please help?  Thanks alot, luke

 

 

<?php

$name = $_REQUEST['name'];
$email_to = $_REQUEST['email'];
$email_you = "[email protected]";
$enquiry = $_REQUEST['enquiry'];
$subject = "Booking Enquiry: " . $name;

$header .= "From: ".$email_you."\r\n";
$mailresult  = mail($email_to,$subject,$enquiry, $header);

if($mailresult) { echo 'Email Sent!'; } else { echo 'Error!'; } 

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.