This is qmail-inject function sends email.
Date format is $date = date("m:d:Y");
#1. When I receive email, date is incrrect year 2086. something like that. What format date should be?
#2. Why $from = "John Smith email@email.com" is not working. The "from" parameter is wrong . How to pass "from" parameter to the script?
Function is below
function
qmail_inject($from,$to,$subject,$msg) {
if ( $fh = popen("/var/qmail/bin/qmail-inject -f$from", 'w') ) {
$date = date("m:d:Y");
$content="Return-Path: ".$from."\n";
$content.="Date: ".$date."\n";
$content.="From: ".$from."\n";
$content.="Subject: ".$subject."\n";
$content.="Sender: ".$from."\n";
$content.="To: ".$to."\n";
$content.=$msg."\n";
fputs ($fh, $content);
if ( ($qmail_exit = pclose($fh)) != 0 ) {
return FALSE;
}
return TRUE;
} else
return FALSE;
}