View Single Post
Old 21st January 2011, 21:57
sajo sajo is offline
Join Date: Oct 2006
Posts: 42
Thanks: 4
Thanked 1 Time in 1 Post

Originally Posted by princebenin View Post
The script written by Still log the e-mails but not sending them.
I try to make this script working several times but no luck.
I have same problem, the script is logging but no emails is sent out.
I check mail.log and there is fatal error with sendmail.

PHP Code:
Jan 21 20:54:44 server imapdConnectionip=[::ffff:]
Jan 21 20:54:44 server imapdLOGINuser=sajoip=[::ffff:], port=[55615], protocol=IMAP
Jan 21 20
:54:44 server postfix/sendmail[14649]: fatalusagesendmail [options]
Jan 21 20:54:44 server imapdLOGOUTuser=sajoip=[::ffff:], headers=0body=0rcvd=430sent=327time=

this is my phpsendmail file

PHP Code:
server:/home/damjan# vi /etc/php5/apache2/php.ini
server:/home/damjan# vi /usr/local/bin/phpsendmail

  This script is a sendmail wrapper for php to log calls of the php mail() function.
  Author: Till Brehm,
  (Hopefully) secured by David Goodwin <david @>

$sendmail_bin '/usr/sbin/sendmail';
$logfile '/var/log/mail.form';

//* Get the email content
$logline '';
$pointer fopen('php://stdin''r');

while (
$line fgets($pointer)) {
preg_match('/^to:/i'$line) || preg_match('/^from:/i'$line)) {
$logline .= trim($line)." \n";
$mail .= $line;

//* compose the sendmail command
$command 'echo ' escapeshellarg($mail) . ' | '.$sendmail_bin.' -t -i';
for (
$i 1$i $_SERVER['argc']; $i++) {
$command .= escapeshellarg($_SERVER['argv'][$i]).' ';

//* Write the log
file_put_contents($logfiledate('Y-m-d H:i:s') . ' ' $_ENV['PWD'] . ' ' $loglineFILE_APPEND);
//* Execute the command
return shell_exec($command);
Please, need some help.
Thanks in advance
Reply With Quote