skymedia
10-17-2001, 09:54 AM
Hi,
I've noticed that many ISPs are filtering emails by their header
information. So, if the email is sent by a PHP script using the mail()
function, it will be deleted by some hosts.
The email header sent from a php script has the following lines:
Return-Path: <httpd>
Received: (from httpd@localhost)
My question is.... is there a way to change this lines?
Any help would be very much apreciated.
Regards,
BravoComm
10-17-2001, 10:24 AM
You can change the Reply-to address by adding a line to the mail headers variable. Like this:
$mailheaders = "From: info@yourdomain.com\n";
$mailheaders .= "Reply-To: info@yourdomain.com";
Is that what you were asking?
skymedia
10-17-2001, 10:42 AM
No, I need to change these lines:
Return-Path: <httpd>
Received: (from httpd@localhost)
My whole header looks like this:
Return-Path: <httpd>
Received: (from httpd@localhost)
by www.myhost.com.ar (8.10.2/8.10.2) id f9HEZ0R17887;
Wed, 17 Oct 2001 11:35:00 -0300
Date: Wed, 17 Oct 2001 11:35:00 -0300
Message-Id: <200110171435.f9HEZ0R17887@www.myhost.com.ar>
To: aboismoreau@myhost.com.ar
Subject:
From: SKYmedia<info@skymedia.com.ar>
Reply-To: SKYmedia<info@myhost.com.ar>
Error-To: SKYmedia<info@myhost.ar>
Content-type: text/html
X-UIDL: m7H!!,?n"!_4G!!1(M!!
I've found this at www.php.net:
This function may replace mail() and it allows you to send mail with correct Retrun-Path and all other headers. Note that extra-headers are included in message string, so you can use, for example, the output from imap_mime_compose directly).
Remember to add two \n in order to separate headers from body (not needed if you use imap_mime_compose).
It uses sendmail program (look at the path).
Try this and hope it works (tested under linux running the postfix mail system):
$message="Content-type: text/plain\n\nYou message HERE\n";
sendmail("from@host.com","to@host.com","test mail",$message);
/* this funcion returns true on success */
function sendmail($from,$to,$subject,$message) {
$pipe=popen("/usr/sbin/sendmail -r \"$from\" -f \"$from\" ","w");
if (!$pipe) return false;
fputs($pipe,"To: $to\n");
fputs($pipe,"Reply-To: $from\n");
fputs($pipe,"Errors-To: $from\n");
fputs($pipe,"From: $from\n");
fputs($pipe,"Subject: $subject\n");
fwrite($pipe,$message);
return !pclose($pipe);
}
nudetravel
10-17-2001, 10:44 AM
I have had problems with return-path too - particularly when used with ezmlm. You need to add a return path statement:
$headers .= "Return-Path: <birthday@php.net>\n"; // Return path for errors
You can get all educated about php mail function headers at
http://www.php.net/manual/en/function.mail.php