Forum Moderators: coopster
<?php
$to = "me@mydomain.com";
$subject = $_POST['subject'];
$body = $_POST['body'];
$headers="From: " . $_POST['emailAddress'] ."\n";
mail($to,$subject,$body,$headers);
?>
hooray.
This one (same domain, different directory at the same level) sends mail but the return/From has _______@web.pas.earthlink.net appended to it -- why is that?
<?php
$to = "mikep@example.com";
$email = $_POST['email'];
$subject = $_POST['subject'];
$body = $_POST['body'];
$headers="From: " . $_POST['emailAddress'] ."\n";
mail($to,$subject,$body,$headers);
?>
-- and --
This one doesn't work... I can't see it, can you? please?
<?php
$to = "me@mydomain.com";
$firstName = $_POST['firstName'];
$lastName = $_POST['lastName'];
$email = $_POST['email'];
$streetAddress = $_POST['streetAddress'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$helpCities = $_POST['helpCities'];
$comments = $_POST['comments'];
$headers="From: " . $_POST['emailAddress'] ."\n";
mail($to,$firstName,$lastName,$email,$streetAddress,$city,$state,$zip,$helpCities,$comments,$headers);
?>
Thanks for your help.
Mike
[edited by: jatar_k at 3:01 am (utc) on Feb. 22, 2006]
[edit reason] generalized email [/edit]
I am not sure why the second appends to the from, I can only guess something is different with the data being sent as there is little or no difference in the code
the third one I can tell you
bad mail function call
mail($to,$firstName,$lastName,$email,$streetAddress,$city,$state,$zip,$helpCities,$comments,$headers);
the aboce is not valid, way too many parameters. My wild guess is you want to add alll of those to the body of the email. You need to concatenate them all into a single var and then pass that as the body of the email.
<?php
$to = "me@mydomain.com";
$subject = $_POST['subject'];
$body = $_POST['$to . $firstName . $lastName . $email, . $streetAddress . $city . $state . $zip . $helpCities . $comments'];
$headers="From: " . $_POST['emailAddress'] ."\n";
mail($to,$subject,$body,$headers);
?>
Or have I the wrong form again...?
Thanks
Mike
$headers = '';
$sourceemail = $_POST['emailAddress'];
$myname = 'Mr Bo Jangles';
$headers .= "From: " . $myname . " <" . $sourceemail . ">\r\n";
$headers .= 'Subject: ' . $subject . "\r\n";
$headers .= "Return-Path: " . $sourceemail . "\r\n";
$headers .= "Reply-To: " . $sourceemail . "\r\n";
$headers .= "Content-type: text;\r\n";
$headers .= "Mime-Version: 1.0\r\n";
I apologize, I obviously didn't look at your above post or I was dead when I did
this line is wrong
$body = $_POST['$to . $firstName . $lastName . $email, . $streetAddress . $city . $state . $zip . $helpCities . $comments'];
should be something like this
$body = $_POST['to'] . "\n" . $_POST['firstName'] . "\n" . $_POST['lastName'] . "\n" . $_POST['email'] . "\n" . $_POST['streetAddress'] . "\n" . $_POST['city'] . "\n" . $_POST['state'] . "\n" . $_POST['zip'] . "\n" . $_POST['helpCities'] . "\n" . $_POST['comments'] . "\n";
I seperated each value with a new line. man am I sorry, I can't believe I did that.
Try that with line with those headers and try again