I'm trying to setup an easy mail server to support my "lost password" function in my website.

I'd like to know if Exim is good or not, or is there any better solution?

I would also like to know that it isn't easy to manage an smtp server (such as blocking junk mail, or being hacked, etc), does setting up a send-only mail server cause any security issues?


  • You might want to use postfix – mcantsin Apr 28 '14 at 13:24
  • Make sure that Exim4 is only listening on localhost, or you will be sending spam in no time. – Louis Matthijssen Apr 28 '14 at 13:39
  • Sending spam? I didn't get it. – KKyang Apr 28 '14 at 15:13
  • @KKyang what Louis means is, that you don't want to accept mail from the outside, which would cause massive spam. You can either configure exim or postfix to only accept mail from localhost, or also use iptables to block smtp ports from outside. – mcantsin Apr 28 '14 at 15:34

Simple example to setup postfix with satellite SMTP

  1. install postfix

    sudo aptitude install postfix

  2. configure postfix

    sudo vi /etc/postfix/smtp_auth

    add your smtp authentication information in /etc/postfix/smtp_auth:

    smtp.foo.bar user@host:password

    and generate the postfix lookup table file (/etc/postfix/smtp_auth.db) using

    sudo postmap /etc/postfix/smtp_auth

    add the relayhost (outgoing smtp server e.g. smtp.foo.bar on port 587, depending your relay host info) information to /etc/postfix/main.cf:

    relayhost = [smtp.foo.bar]:587

    add the following lines to /etc/postfix/main.cf in order to enable smtp-auth for outgoing mails:

    smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/smtp_auth smtp_sasl_security_options = noanonymous

  3. restart postfix

    sudo service postfix restart

  • So sasl is something like ssl that can avoid someone hijack the mail and read the content. Is that right? – KKyang Apr 28 '14 at 15:27
  • @KKyang, yes SASL is Simple Authentication and Security Layer, a framework for authentication and data security in Internet protocols. You want to submit your SMTP authentication encrypted, and probably also the body of the e-mail. Therefore use SSL or TLS, when connecting to the remote SMTP relay host. – mcantsin Apr 28 '14 at 15:31
  • 1
    Thanks! So if I want to make sure my mail is sent secured, I should use both SASL and SSL? – KKyang Apr 28 '14 at 15:48
  • @KKyang yes. SASL with TLS or SSL. – mcantsin Apr 28 '14 at 15:48

I had a similar problem and here is how I did. I created a gmail account for my daemon. I set up filters from gmail.com.

And I send my mail using http://iqjar.com/jar/sending-emails-from-the-raspberry-pi/

The guide is for raspberry pi but it will work as long as you use a debian or alike)

If you protected your server from bruteforce (fail2ban ?), it should be fine.

  • The website I setup is my university's lab website. I don't know if it's ok to use a personal account as an organization account. (If I graduate, I might want to take the account away.)) – KKyang Apr 28 '14 at 15:21
  • ssmtp does NOT verify the SSL/TLS certificate of the remote server on the current debian, ubuntu and redhat releases and also does NOT verify the hostname of the certificate. This is a major issue, as this effectively renders the encryption useless and your password is being transmitted alike to being plaintext and anyone can sniff it. ssmtp has had no active development since atleast 2009. So, if you care about the security of the email account you use for your servers outgoing emails, do NOT use ssmtp, but postfix (or something else) instead. – Zulakis Feb 24 '16 at 10:45

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.