Hello. I'm currently attempting to send an e-mail using a simple php contact form on my website. The form works and I receive the e-mail, but when I receive the e-mail, it says the e-mail is from email@example.com which is my default cpanel e-mail. How do I change it to where it shows it is from my domain? Here is the php I am using
<?php // Email Submit $name = @trim(stripslashes($_POST['name'])); $email = @trim(stripslashes($_POST['email'])); $subject = @trim(stripslashes($_POST['subject'])); $message = @trim(stripslashes($_POST['message'])); $email_from = $_POST["from address here"]; $email_to = 'to address here'; $message = 'Name: ' . $name . "\n\n" . 'Email: ' . $email . "\n\n" . 'Subject: ' . $subject . "\n\n" . 'Message: ' . $message; $success = @mail($email_to, "[The Sauce] ".$subject, $message); $noreply = @mail($email_from, "[Thank you]", "Thank you for contacting us. We will be in touch soon!"); ?>
@jwat1537 in your code, you have to pick up the default email address from the server.
You can change this line:
$email_from = $_POST["from address here"];
And make it your own email address, like this:
$email_from = "firstname.lastname@example.org";
Hope it helps!