Jump to content

changing the "from" element of an email


barrowvian

Recommended Posts

i have a contact form on my website, when someone uses it the 'from' field in the email just states that its come from my website (more specifically my username from my hosting account). Is there a way to change it to display the name or email address of the person that has submitted the form?

Link to comment
https://forums.phpfreaks.com/topic/201982-changing-the-from-element-of-an-email/
Share on other sites

could try this...

 

<?php
$to      = 'user@domain.com';
$subject = 'Subject';
$message = 'This is a test';
$headers = 'From: webmaster@yourdot.com' . "\r\n" .
   'Reply-To: webmaster@yourdot.com' . "\r\n" .
   'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?>

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.