Website Setup & Info

ID #1046

My web site sends mail, but the messages never arrive. Do I need to do anything special to send mail from my site?

Around the end of December 2005, we added a requirement that any mail originating from the web server has to have a proper envelope-sender set (aka, the 'Return-Path' header). Directly affected are sites that send using PHP's mail() function, or any similar call that results in a call to the sendmail command.

Specifically, mail from the web server defaults to a return path of 'www', since currently the webserver runs as the 'www' user. The mail server now rejects any mail from the www user, so the mail will queue up in the 'www' user's mailbox on the web servers.

To have your website send mail from the webserver, you have two options:

  1. Set a proper Return-Path / Envelope sender on all outgoing messages. A PHP example is included below.
  2. Send mail via SMTP.  You can use either 'localhost' or 'mail.int.geekisp.com' as your SMTP server.  No authentication is required.

When choosing the envelope-sender, please make sure it is an address that can receive bounces.

PHP users can send mail using code similar to the following:

$headers = "From: foo-bar@example.com\n";
$headers .= "X-Sender: \n";
$headers .= "X-Mailer: PHP4\n";
$headers .= "X-Priority: 3\n";
mail($to, $subj, $message, $headers, '-f foo-bar@example.com');


In summary, only one thing is required to send mail via the 'sendmail' binary, no matter what language you're using. You must invoke sendmail with the '-f <email>' option, to send the envelope sender. The address you specify must be a valid email!

Tags: -

Related entries:

Last update: 2009-10-13 12:01
Author: Dave Steinberg
Revision: 1.1

Digg it! Print this record Send to a friend Show this as PDF file
Propose a translation for Propose a translation for
Please rate this entry:

Average rating: 1 out of 5 (1 Votes )

completely useless 1 2 3 4 5 most valuable

You cannot comment on this entry