Is it possible to use mail() on localhost??

0 Hanky Banky · March 2, 2015
Is it possible to send an email from my test site on localhost??

This would be the code:

<?php
$to = "somebody@example.com";
$subject = "My subject";
$txt = "Hello world!";
$headers = "From: webmaster@example.com" . "\r\n" .
"CC: somebodyelse@example.com";

mail($to,$subject,$txt,$headers);
?>

Post a Reply

Replies

Oldest  Newest  Rating
+1 Spikeedoo G · March 3, 2015
Yes it is...though....
you will receive it as a .txt file in /xammp/mailoutput

The only thing that doesn't work are obviously line breaks as it is a text file.

:)
  • 1

PHP

107,048 followers
About

Server-side, HTML embedded scripting language used to create dynamic Web pages.

Links
Moderators