Re: Help needed for my first mail server
On Tue, 15 Mar 2011 01:13:57 -0500
Jason Hsu <firstname.lastname@example.org> wrote:
> This is my first time ever working with a mail server. Thus, I don't
> know what I'm doing, but I'm trying to learn.
> All I'm trying to do right now is send and receive email messages
> through my free DynDNS account. Let's say it's
> subdomain1.dyndns-free.com .
> The OS is Debian Lenny. The mail server is exim4.
> Let's say that the host name listed in my /etc/hosts file is
> subdomain2.domain.com .
> I have been able to run the exim4 configuration script by entering
> "dpkg-reconfigure exim4-config". However, I don't know what I'm
> supposed to enter for all those fields I'm asked about. If I'm even
> slightly wrong on just one thing, my system won't work properly.
> Do I need an MX hostname? There are so many unknowns that I don't
> know where to begin.
And that's the problem, nor do we. This isn't really a subject which
can be covered well by question and answer. The exim4 manual is
excellent, but it's a giant man page. It's great for looking up
details, but it's not a tutorial on email, or even exim4. Don't forget
later that exim4 does also have a man page. It won't be much use yet,
but some of those sendmail two- and three- letter commands are
extremely useful for troubleshooting.
Unfortunately, most email tutorials bring in clamav, spamassassin and
other stuff, which you may want later but only complicates the first
attempts to get SMTP working. Try this one:
to begin with, but even that needs some changes. To receive external
email, it will also need to listen on the interface connected to the
router, not just 127.0.0.1 (though you do want that as well). You'll
also want the FQDN to be the domain name, without the computer name at
the beginning. You'll want Maildir format if you plan to use IMAP
with email clients, but it's probably a good idea anyway. There may be
other details I haven't noticed...
Once you've got the sending working (and check first using Mutt or mail
to a variety of email address styles to accounts on the machine itself,
then to outside addresses) then receiving is just a matter of piping
external email to the server. Forward port TCP/25 to the server, and do
the same at your domain host, DNYDNS in this case, by setting the MX
record to a *hostname* (an IP address will often work, but not for every
sender, and it's not relevant in your case anyway) which points to the A
record for your public IP address (your external public hostname for
remote purposes). Don't forget to configure the server firewall to allow
TCP/25 access on the INPUT chain. Check that Shields Up!! on
http://grc.com can see an open port 25. There are also free DNS and
email domain testing tools out there, which may help with getting the
DNS records as right as you can. Bookmark this page somewhere until you
know how to do it without looking it up:
Yes, I know it comes from the Dark Side, but it's explained clearly for
One of the problems of having a dynamic IP address is that you won't
be able to send email to everyone directly. Email blacklists tend to
contain most of the world's dynamically allocated address blocks, and
mail servers using them will refuse your connections. Unfortunately,
you are indistinguishable from a virus-infected home PC. I suspect the
only way you will get email out to many people is to use a trusted SMTP
server e.g. your ISP's server as smarthost. It's possible DYNDNS offer
use of a smarthost, I've never dealt with them. If need to do this, you
tell exim4 the name of the SMTP server, just as you would an email
client. If you select 'smarthost', it will ask different questions.
The best way to do this is to have a go and come back with specific
questions and error messages. Exim4 has a somewhat cryptic log,
(mainlog in /var/log/exim4) but it should help a lot. Oh, and remember
when you have port 25 open. the whole world will hammer on your door.
It's been a bit quieter in recent weeks, but I've had up to 5,000 bogus
SMTP connection attempts in a single day. I have very aggressive mail