// http://stackoverflow.com/a/23048315
// by Lee Kowalkowski
First run:
sudo mkdir /opt/lampp/mailtodisk
sudo mkdir /opt/lampp/mailoutput
It doesn't exist, but this is my mailtodisk script:
/opt/lampp/mailtodisk/mailtodisk
:
#!/opt/lampp/bin/php
<?php
$input = file_get_contents('php://stdin');
$filename = '/opt/lampp/mailoutput/mail-' . gmdate('Ymd-Hi-s') . '.txt';
$retry = 0;
while(is_file($filename))
{
$filename = '/opt/lampp/mailoutput/mail-' . gmdate('Ymd-Hi-s') . '-' . ++$retry . '.txt';
}
file_put_contents($filename, $input);
Your XAMPP installation might not be in the folder /opt/lampp
, if it isn't, you'll need to edit the script (although it doesn't have to live in the XAMPP folder).
Make sure your mailtodisk script can be run by anybody (chmod 755 mailtodisk
), and your mailoutput folder can be written to by anybody (chmod 777 mailoutput
).
Also,
sudo chmod +x /opt/lampp/mailtodisk/mailtodisk
Then your php.ini
file (/opt/lampp/etc/php.ini
) should have:
sendmail_path=/opt/lampp/mailtodisk/mailtodisk
Any time you edit the php.ini
file, you have to restart Apache.
Installing sendmail if you don't want to send the emails, is overkill.