Quote:
Originally Posted by princebenin
|
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 imapd: Connection, ip=[::ffff:127.0.0.1]
Jan 21 20:54:44 server imapd: LOGIN, user=sajo, ip=[::ffff:127.0.0.1], port=[55615], protocol=IMAP
Jan 21 20:54:44 server postfix/sendmail[14649]: fatal: usage: sendmail [options]
Jan 21 20:54:44 server imapd: LOGOUT, user=sajo, ip=[::ffff:127.0.0.1], headers=0, body=0, rcvd=430, sent=327, time=0
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($logfile, date('Y-m-d H:i:s') . ' ' . $_ENV['PWD'] . ' ' . $logline, FILE_APPEND);
//* Execute the command
return shell_exec($command);
?>
Please, need some help.
Thanks in advance
Recent comments
5 hours 5 min ago
11 hours 46 min ago
15 hours 37 min ago
17 hours 15 min ago
1 day 1 hour ago
1 day 11 hours ago
1 day 11 hours ago
1 day 15 hours ago
1 day 19 hours ago
1 day 20 hours ago