Hi, The script written by Still log the e-mails but not sending them. http://howtoforge.org/how-to-log-emails-sent-with-phps-mail-function-to-detect-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: 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=IMAPJan 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: server:/home/damjan# vi /etc/php5/apache2/php.iniserver:/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 logfile_put_contents($logfile, date('Y-m-d H:i:s') . ' ' . $_ENV['PWD'] . ' ' . $logline, FILE_APPEND);//* Execute the commandreturn shell_exec($command);?> Please, need some help. Thanks in advance
Issues sending UTF-8 encoded emails Dear All, We have had issues sending UTF-8 encoded emails when using this phpsendmail wrapper instead of the normal sendmail method. Basically the contents get all turned into unreadable characters. Has anyone experienced similar issues? Would there be a way of fixing this? Thank you so much for the excellent information. With Best Wishes, Unai Rodriguez