note 14830 deleted from ref.mail by jimw

From: Date: Thu, 01 Nov 2001 19:59:53 +0000
Subject: note 14830 deleted from ref.mail by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-20011@lists.php.net to get a copy of this message
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); }

« previous php.notes (#20011) next »