Setting up a localhost mail server on Mac OSX
- by Thom
I asked this over on stackoverflow.
I would love to be able to test php webapps that require emailing registration info etc. on my mac. I downloaded a version of CommuniGate Pro. I need to mail either to an account inside or outside (whichever is best) of the localhost. Again this would be used for testing purposes to verify and debug my code prior to uploading to a hosting service. Any ideas, help and/or examples would be very much appreciated. If it would be easier I could go over to Windows XP. That would just mean setting up wamp and transfering my files over from the mac side via dropbox.
I got the local mailserver to work so I can send emails between accounts. However, I cannot seem to get the php code to work. I know that I am missing something.
<?php
function email($to, $subject, $body, $headers) {
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'From: <[email protected]>' . "\r\n";
mail($to, $subject, $body, $headers);
}
?>