Answer the question
In order to leave comments, you need to log in
Is there a "ready, lightweight" local mail server for debugging scripts?
Greetings!
Is there a "ready, lightweight" mail server (installation in one package that does not require a bunch of settings a la Postfix)?
Wishlist are:
1. The ability to connect ordinary clients
2. Purely "local" without using external existing accounts.
3. Easy simple installation, easy creation of test accounts.
Answer the question
In order to leave comments, you need to log in
If quite primitive, then in php.ini
[mail function]
sendmail_from = me@example.com
sendmail_path = "php /path/to/sendmail_simple_emulator.php"
$MailDir = __DIR__.'/log/'; // папка для сохранения писем
if (!is_dir($MailDir)) {
mkdir($MailDir, 0644);
}
$data = "";
$line = 'foo';
$f = fopen("php://stdin", "r");
while( !feof($f) AND ($line!='') ) {
$line = fgets($f,255);
$data .= $line;
}
fclose($f);
$data = str_replace("\r", '', $data);
$data = str_replace("\n", PHP_EOL, $data);
$i = 0;
$addon = '';
while ( file_exists( $fname = ($MailDir.'/'.date('Y-m-d-H-i-s').$addon.'.eml') )) {
$addon = '-' . ++$i;
}
file_put_contents($fname, $data);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question