如何在后台和脚本输出邮件中运行php进程(脚本)。
前:
exec('php backgroundScript.php 2>&1 &'),但需要在邮件中获得输出,而不是文件。现在,如何使用exec或任何其他命令在邮件中输出backgroundScript.php脚本?
没有什么问题,但我需要邮件输出的后台脚本进程,和主脚本下命令执行流继续.不等待后台脚本进程。
发布于 2014-07-09 14:57:15
尝试将您在exec行中的输出传输到mailx命令。
| mailx -s 'Hi' 'xyz@abc.com' 或者很可能您正在使用sendmail
| sendmail -s "My Test Email Subject" test@email.com因此,请尝试以下几点:
exec('php backgroundScript.php | sendmail -s "My Test Email Subject" test@email.com 2>&1 &')发布于 2014-07-09 15:02:18
要从php脚本发送电子邮件,请使用mail函数:
bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] )https://stackoverflow.com/questions/24656053
复制相似问题