Use of mailtodisk / mailoutput in XAMPP for Linux

冷暖自知 提交于 2019-12-04 12:22:59

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).

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.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!