Correct usage of From: headers with mail sent through PHP (sender envelope)

Last updated on 28 Sep 2023, 10:32:35.
Category: Email

PHP Sendmail

A well known problem when sending e-mails through webservers is the wrong From: address that by default points to the server's name. This can cause some problems: mails never arrive, replies are sent to a non active or not actively checked mailbox and bounces may arrive at the hosting company or worse disappear in the bitbucket.

In PHP it is relatively easy to fix:

<?php

 mail('nobody@yourdomain.com', 'subject', 'message', null, '-f from@yourdomain.com');

?> 

The last parameter ' -f ' allows you to specify the From: address for the sendmail function.


Related articles

Order an SSL certificate? What is an SSL certificate?

You need to order an SSL certificate? But what is an SSL certificate? And why is everyone saying that it...

Read more

SHA1, SHA2 and SHA256 SSL algorithms

SHA is a mathematical algorithm used in SSL encryption to verify the validity of the certificate's signature. Different iterations of...

Read more

Why do I see a yellow warning triangle on an HTTPS secured website?

The yellow warning triangle you may see when visiting a webpage that's secured with SSL, is an indication that Google...

Read more

Need extra help?

Were not all your questions answered?
Don't worry, we will be happy to help you via a support request!

Select your language

All languages: