Setting up a localhost mail server on Mac OSX

Posted by Thom on Super User See other posts from Super User or by Thom
Published on 2012-06-06T21:20:32Z Indexed on 2012/06/06 22:42 UTC
Read the original article Hit count: 575

Filed under:
|

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);
}
?>

© Super User or respective owner

Setting up a localhost mail server on Mac OSX

Posted by Thom on Server Fault See other posts from Server Fault or by Thom
Published on 2012-06-06T22:39:38Z Indexed on 2012/06/06 22:41 UTC
Read the original article Hit count: 575

Filed under:
|
|

I asked this over on stackoverflow. They pointed me here.

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.

I see where this has been asked before. I want to add that I am using xampp. In Mac OS 10.6.8. I tried changing the php.ini SMTP command to macintosh-3.local.

<?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);
}
?>

© Server Fault or respective owner

Related posts about osx

Related posts about php