How to setup an SMTP server on Mac OS X?

34,731

Solution 1

The following did the job. See source here.

  1. Edit file: sudo emacs /System/Library/LaunchDaemons/org.postfix.master.plist.
  2. Add <key>RunAtLoad</key> <true/> <key>KeepAlive</key> <true/> before the closing </dict> tag.
  3. Run sudo postfix start.

Check that SMPT is running: telnet localhost 25

Solution 2

Option 1:

CommandLineFu had this one liner to run an SMTP server on port 25:

sudo python -m smtpd -n -c DebuggingServer localhost:25

This will run a fake smtp server on your local machine. It won't send anything, but will dump it to the console.

Option 2:

Incase, you are not comfortable with command line then FakeSMTP is a Free Fake SMTP Server with GUI for testing emails in applications easily. It is written in Java. It is very nice and easy to use.

[http://nilhcem.com/FakeSMTP/][1]

Share:
34,731
0x90
Author by

0x90

echo \[q\]sa\[ln0=aln256%Pln256/snlbx\]sb3135071790101768542287578439snlbxq|dc

Updated on October 08, 2020

Comments

  • 0x90
    0x90 over 3 years

    I work with PHP and I have mamp on my machine. I would like to send emails within my PHP code:

    <?php
     $to = "[email protected]";
     $subject = "Hi!";
     $body = "Hi,\n\nHow are you?";
     if (mail($to, $subject, $body)) {
       echo("<p>Message successfully sent!</p>");
      } else {
       echo("<p>Message delivery failed...</p>");
      }
     ?>
    

    How can I configure a mail server for free on my mac machine ?

  • Ameed Aabidi
    Ameed Aabidi over 6 years
    Even though I'm across after a long time, please update the source. It seems to not work.
  • AlikElzin-kilaka
    AlikElzin-kilaka over 6 years
    Syed, I didn't write the missing article. Feel free finding a replacement source.
  • micseydel
    micseydel over 5 years
    I didn't have that file, although I did have /System/Library/LaunchDaemons/com.apple.postfix.master.plist It didn't have edit permission so I tried just starting the service, which seemed to work by itself.
  • Vladtn
    Vladtn over 3 years
    This is brilliant