hey there,

whenever i send an email i get "me" as sender and when opening the mail me@127.0.0.1 to me
shows up in gmail.

here is my code:

$head = 'From: $buyeremail' . "\r\n" . 'Replay-To: $buyeremail'. "\r\n" . 'X-Mailer:'. 'PHP/' . phpversion();
$name = $_POST['buyername'];
$to = $_POST['email'];
$subject = $_POST['itemname'];
$body = "whatever";

mail($to,$subject,$body,$head);

Any idea?

Not sure what the value's syntax looks like for your $buyeremail looks like, but make sure you are adding it in the correct syntax.

$headers .= 'From: Birthday Reminder <birthday@example.com>' . "\r\n";

That code was from this page: http://php.net/manual/en/function.mail.php (Example #4)

If the "From" section of your header doesn't have the correct syntax (or if it's just not included), I believe PHP puts the default address for the server, which 'me@127.0.0.1' sounds like a good candidate for. You can see the examples of correct syntax for the e-mail's headers in mail() on that page I linked above.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.