在XAMPP for Linux中使用mailtodisk/mailoutput [英] Use of mailtodisk / mailoutput in XAMPP for Linux

查看:93
本文介绍了在XAMPP for Linux中使用mailtodisk/mailoutput的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

与Windows不同,我在Linux中无法使用"mailtodisk" PHP选项.看来它甚至不存在.

Unlike in Windows, i'm having trouble to use the "mailtodisk" PHP option in Linux. Looks like it doesn't even exist.

在"php.ini"的邮件"部分中,没有对其的引用:

In "php.ini", in the mail section, there is no reference to it:

[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP=localhost
; http://php.net/smtp-port
smtp_port=25

; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = me@example.com

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
;sendmail_path =

; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =

; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
mail.add_x_header=On

; Log all mail() calls including the full path of the script, line #, to address and headers
mail.log ="/opt/lampp/logs/php_mail_log"

[SQL]

我无法在localhost主页上看到邮件"链接,以测试默认的邮件格式,因为它会发生很多类似这样的崩溃:

I can't see the "Mail" link in the localhost homepage, for test the default mail form, because it's with many crashes like this one:

Notice: Undefined variable: TEXT in /opt/lampp/htdocs/xampp/start.php on line 12

糟糕:尽管在localhost主页上出现此错误,但我正在运行项目时没有问题.

Obs: despite this errors in the localhost homepage, i'm running projects without a problem.

实际上,菜单中似乎没有邮件"链接(我已经搜索了源代码).

In fact, it doesn't seems to have a "Mail" link in the menu (i've searched the source code).

我不知道此信息是否有任何帮助,但是文件"sendmail.php"使用的文件在我的系统中不存在:/usr/sbin/sendmail.

I don't know if this info helps in any way, but the file "sendmail.php" uses a file that doesn't exist in my system: /usr/sbin/sendmail.

XAMPP的当前版本为:1.8.3,最近更新了.

The current version of XAMPP is: 1.8.3, and was recently updated.

是否可以在XAMPP for Linux中使用"mailtodisk"?如果是,我在我的情况下需要做什么?

Is it possible to use "mailtodisk" in XAMPP for Linux? If yes, what i need to do in my situation?

推荐答案

它不存在,但这是我的mailtodisk脚本:

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

您的XAMPP安装目录可能不在文件夹/opt/lampp中,如果没有,则需要编辑脚本(尽管它不必位于XAMPP文件夹中).

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

确保您的mailtodisk脚本可以由任何人(chmod 755 mailtodisk)运行,并且您的mailoutput文件夹可以由任何人(chmod 777 mailoutput)写入.

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

然后您的php.ini文件(/opt/lampp/etc/php.ini)应该具有:

Then your php.ini file (/opt/lampp/etc/php.ini) should have:

sendmail_path=/opt/lampp/mailtodisk/mailtodisk

每次编辑php.ini文件时,都必须重新启动Apache.

Any time you edit the php.ini file, you have to restart Apache.

如果不想发送电子邮件,则安装sendmail实在是太过分了.

Installing sendmail if you don't want to send the emails, is overkill.

这篇关于在XAMPP for Linux中使用mailtodisk/mailoutput的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆