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

Quote:
Originally Posted by princebenin View Post
Hi,
The script written by Still log the e-mails but not sending them.

http://howtoforge.org/how-to-log-ema...tect-form-spam
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:127.0.0.1]
Jan 21 20:54:44 server imapdLOGINuser=sajoip=[::ffff:127.0.0.1], port=[55615], protocol=IMAP
Jan 21 20
:54:44 server postfix/sendmail[14649]: fatalusagesendmail [options]
Jan 21 20:54:44 server imapdLOGOUTuser=sajoip=[::ffff:127.0.0.1], 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
#!/usr/bin/php
<?php

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

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

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

while (
$line fgets($pointer)) {
        if(
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