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

Managed services in the spotlight

Our system administrators have lifted a couple of cargo ships filled with containers of work. (yes, that pun was on...

Read more

What service level guarantees (SLA) are available for a server housing (co-location)?

Server housing or co-location customers can fall back on an excellent service level guarantee. A Kinamo server housing service comes...

Read more

Discover here how we’ve fixed a blocking error when upgrading ESXi 6.5 to 7.0 update 2 through vSphere Lifecycle Manager.

Kinamo maintains multiple VMware vSphere clusters, not only for our own infrastructure, but also for a variety of customers. As...

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!

Kinamo

Select your language

All languages: