Appearance of emails sent from the website

I’m trying to understand why emails sent from my website appear like shown on the following screenshot.


Does anyone have an idea ?

Here is the php code for the contact form

if(empty($_POST['name_01']) && strlen($_POST['name_01']) == 0 ||
empty($_POST['email_01']) && strlen($_POST['email_01']) == 0 ||
empty($_POST['phone_01']) && strlen($_POST['phone_01']) == 0 ||
empty($_POST['subject_01']) && strlen($_POST['subject_01']) == 0 ||
empty($_POST['message_01']) && strlen($_POST['message_01']) == 0)
return false;

$name_01 = $_POST['name_01'];
$email_01 = $_POST['email_01'];
$phone_01 = $_POST['phone_01'];
$how_01 = $_POST['how_01'];
$subject_01 = $_POST['subject_01'];
$message_01 = $_POST['message_01'];

$to = ''; // Email submissions are sent to this email

// Create email	
$email_subject = "Message de";
$email_body = "Message de \n\n".
			  "Name_01: $name_01 \nEmail_01: $email_01 \nPhone_01: $phone_01 \nHow_01: $how_01 \nSubject_01: $subject_01 \nMessage_01: $message_01 \n";
$headers = "MIME-Version: 1.0\r\nContent-type: text/plain; charset=UTF-8\r\n";	
$headers .= "From:\n";
$headers .= "Reply-To: $email_01";	

mail($to,$email_subject,$email_body,$headers); // Post message
return true;			

They look like that because the email has actually been sent from your server rather than the email address left by the visitor.

This is quite normal and when you hit the reply button it will use the email address that the visitor left.

1 Like

You’d actually want that. When you use the address left by the visitor and send from that address, chances are quite big your message will be blocked due to the presence of an SPF (Sender Policy Framework). That record defines which servers are permitted to send messages in name of that specific domain.
Because otherwise you’re in essence spoofing the message, which is a spam technique.

1 Like

That’s a good point. I think people are just confused that it shows the server address rather than the listed sender who actually wrote the message. Obviously the sender has to write down their email correctly or there is no way to reply.

1 Like

I’ve just realised that my Contact Form on my old Website showed the same server address. For some reason, I thought that the address looked cleaner. I guess there is no way to change it, as it has to go through the server…?

Its showing the email server address, but it shouldn’t be that important as you are the only one getting the response email. Your customer doesn’t see it at all.

It does show up in the reply email when quoting original text but that can be edited to show the visitors address if it really bothers you.

I guess I pay too much attention to detail ! :joy:

I’ve just changed one line in the .php file, so I have the address of the client straight away.
Easier to read when I get a new email.

Just a question, what did you exactly alter? Might be good for future reference.

1 Like

@brechtryckaert I did alter one of the Headers Line.
I basically just asked for the client’s address instead.

1 Like

Thanks, this way this is documented for future users that might bump into the same issue.

1 Like