Mein Gott. man kann es sich aber auch schwer machen.
<?php
$to = "mein.name@gmx.de";
$subject = "Hello World";
$message = "Test";
if ('localhost' == $_SERVER['SERVER_NAME']) {
test_mail($to, $subject, $message);
} else {
mail($to, $subject, $message);
}
function test_mail($to, $subject, $message) {
$mail = implode("\r\n\r\n", array($to, $subject, $message));
return file_put_contents ('mail.txt', $mail);
}