how to send mail from localhost

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
siko
Forum Commoner
Posts: 37
Joined: Tue Feb 16, 2010 11:28 pm

how to send mail from localhost

Post by siko »

$to = "siko@gmail.com;

$subject = "Testing";
$message = "Test";
$headers = 'From: noreply@ siko.com' . "\r\n" . 'Reply-To: noreply@ siko.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);

This is my code for sending an email from my web host. I recently setup a localhost to work from, and I realized that this does not work on my localhost.

I did manual installation of apache, php and mysql individually, and I think I'm suppose to install a mail server locally or something like that, but I'm kinda lost.

If so, which mail server should I go for?

Any advices?

Thanks in advance!
Doug G
Forum Contributor
Posts: 282
Joined: Sun Sep 09, 2007 6:27 pm

Re: how to send mail from localhost

Post by Doug G »

Windows or linux or something else?
siko
Forum Commoner
Posts: 37
Joined: Tue Feb 16, 2010 11:28 pm

Re: how to send mail from localhost

Post by siko »

Ah, forgot to mention that, I'm on Mac os x, Lion to be exact.

Regards
Post Reply