Added support for mail() inside chroots

This commit is contained in:
Daniel Winzen
2020-01-05 15:50:08 +01:00
parent f573f79f6c
commit d7c886bb54
11 changed files with 63 additions and 14 deletions

16
var/www/mail/index.php Normal file
View File

@ -0,0 +1,16 @@
<?php
$head = true;
$content = str_replace("\r\n", "\n", $_POST['content']);
$lines = explode("\n", $content);
$mail = '';
foreach($lines as $line){
if($head && stripos(ltrim($line), 'FROM')===0){
continue;
}
if($head && $line===''){
$head = false;
$mail .= "From: $_SERVER[MAIL_USER]\r\n";
}
$mail .= "$line\r\n";
}
exec('echo ' . escapeshellarg($mail). ' | sendmail -t -f ' . $_SERVER['MAIL_USER']);