17

What is the absolute, bare minimum, no-hassle, hopefully idiot-proof way of setting up a local smtp server?

If you're going to say postfix, what are these alledgedly bare minimum, idiot proof steps to setting it up?

I'm sort of amazed at how difficult it seems to find this anywhere. I need:

  • a locally hosted smtp server that sends mail to the internet.
  • no tls or saslauth or whatever.
  • only allows mail to come from localhost.
  • no relays.

It seems like there should be some software package somewhere where you install, set up an account and then you have a local smtp server.

I'm not a sysadmin. People say postfix is dead simple but maybe I'm doing it wrong, all the setup docs I see are quite complicated, I actually don't have a spare hour to spend debugging a mailserver. I just want to send mail to the internet. Is it really that hard?

1
  • 3
    Interesting question and I've got the same point of view.
    – Zenklys
    Mar 7, 2012 at 22:53

5 Answers 5

4

Though it us not maintained, you can try esmtp. It does, however, support some of the functionality you don't want, but it is very easy to set up.

From Ubuntu's Synaptic Package Manager description for esmtp:

ESMTP is a user configurable relay-only Mail Transfer Agent (MTA) with a sendmail-compatible syntax. It's based on libESMTP supporting the AUTH (including the CRAM-MD5 and NTLM SASL mechanisms) and the StartTLS SMTP extensions.

The esmtp site lists some other alternatives, of which sSMTP seems the simplest. From Ubuntu's Synaptic Package Manager description for ssmtp:

A secure, effective and simple way of getting mail off a system to your mail hub. It contains no suid-binaries or other dangerous things - no mail spool to poke around in, and no daemons running in the background. Mail is simply forwarded to the configured mailhost. Extremely easy configuration.

0
2

Ignore all the setup documents, you don't need them. On Debian/Ubuntu the setup issues have been dealt with. The debconf setup for the SMTP severs offer you a set of standard configurations. This includes a couple of options which will do what you want. Consider installing the postfix-doc package if you want some documentation.

From my experience the Debian/Ubuntu setup is pretty well the same for Exim4 and Postfix. The following options are for Exim4 but should work for Postfix. You can rerun the configuration with the dpkg-reconfigure command.

The default configuration when you select mail sent by smarthost; received via SMTP or fetchmail should give you very close to what you want. To prevent incoming mail set the listen address for incoming SMTP sessions to 127.0.0.1.

Alternatively, you may want to consider selecting mail sent by smarthost; no local mail. This will send most mail to another system for delivery. Messages about inability to send mail to the other server will be delivered locally.

Normally, the smarthost which will be delivering your mail is your ISP's relay server. On a LAN, MAN, or WAN, there may be a local mail server to use.

0

I have the same needs and just installed postfix on CentOS with these simple commands (ofcourse replace fancyhostname, fancydomain and youremail@yourdomain.com with what's apropriate for you):

# Before you beging setup your hostname properly
# YOU MUST HAVE A VALID HOST NAME
sed -i 's/HOSTNAME=.*/HOSTNAME=fancyname.fancydomain.com/' /etc/sysconfig/network
echo "127.0.0.1   fancyhostname.fancydomain.com    fancyname" >> /etc/hosts
reboot
# check
hostname ; hostname -f ; uname -n; echo `hostname -s`.`hostname -d`
# you should get this output 4 lines like this one:
#   fancyhostname.fancydomain.com
# anything else means you made a mistake above

# installation
#---------------
yum -y install postfix # install postfix
yum -y install mail # makes testing easy - see bellow

# configuration
#---------------
# B) postfix config.
# I only accept mail from localhost - no relaying whatsoever
echo "mynetworks = 127.0.0.0/8" >> /etc/postfix/main.cf
/etc/init.d/postfix reload

# C) where do you want mail for root delivered:
echo "root:     youremail@yourdomain.com" >> /etc/aliases
newaliases

# test
#---------------
echo test | mail -s test root 
sleep 1; tail /var/log/maillog
# now check your mail - you should soon receive the test mail

I'm pretty sure ubuntu can't be any harder. Will soon try it out and report here

0

I came with the same question and it looks like OpenSMTPD is smaller and simplest.

-1

install mailutils

sudo apt-get install mailutils

send an email like this

echo "This is the body of my message. Wow this is so simple" | mail -s "This is my subject line" me@mydomain.com

Source: http://ubuntuforums.org/showthread.php?t=1883221

1
  • The question is actually about hosting an SMTP server, not sending mail which is much more simple. Also you may want to supply a from address -aFrom:you@wherever
    – malatio
    Jun 26, 2014 at 17:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.