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

What is an SPF record?

If you want to prevent your sent mails from ending up in spam or junk folders at the recipient's end...

Read more

Mails sent to gmail.com do not arrive at the recipient

Messages sent to a gmail.com address do not arrive at the recipient. The sender gets an error message back saying...

Read more

I get a notification that my mailbox is over its capacity, what should I do?

The Kinamo mail server automatically sends out a notification when your e-mail address is at 95% of its capacity. In...

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: