F
F
filippokk2015-12-15 22:50:31
PHP
filippokk, 2015-12-15 22:50:31

Sendmail xampp stub?

Please tell me how to make a sendmail stub for xampp on mac os 10.11, I found a couple of articles but it says about windows, on mac it's a little different, I will be grateful for your help.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Stalker_RED, 2015-12-15
@Stalker_RED

In php.ini

[mail function]
sendmail_from = [email protected]
sendmail_path = "php /any/path/you/want/sendmail_simple_emulator.php"

emulator code:
<?php

// Заглушка sendmail 
// based at http://urths.com/blog/заглушка-sendmail/

$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') )) {
  $i++;
  $addon = '-'.$i;
}	

file_put_contents($fname, $data);

O
OnYourLips, 2015-12-15
@OnYourLips

You need to use a driver in your email sending library that either folds letters locally or uploads them to mailtrap servers.

R
romy4, 2015-12-16
@romy4

I've been making stubs here. I think it should go on a poppy. Example one and two

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question