setting up mail server, debian, postfix

Im running debian linux and have gotten apache, php, perl, mysql, and everything else to work, but can't get email to work.  Ive been trying the last three days and am near giving up on using sendmail at all.  What is the easiest MTP I can use and to set up.  I have installed and uninstalled sendmail and postfix on and off again in the last 3 days and couldn't get any of them working at all, which probably means that I dont have a very good understand of the mail server concepts.  Also, it could possible mean that I have screwed up some other settings.

I have static IP SBC DSL and am using to point my domain name:, to my real WAP ip address.  On my router, I have opened up ports 80 for apache, 22 for ssh, 21 for ftp, and 25 for email.

I want to get email to work so I can email to, and so on.  On my debian, system, right now I only have two account: root and tung.  So I guess I would need to set up email accounts admin and help first.
I want to use postfix, because I heard that its compatiable with sendmail, that'll be good because I have perl scripts that use sendmail.

Also, has MX settings what are those all about?
These are:

I have re-installed postfix with apt-get, and when I try to reload postfix, I get this error:
postfix: fatal: /etc/postfix/postfix-script: No such file or directory.
I check the directory, and there's no postfix-script there.
So, now I start, stop and restart postfix by typing in:
/etc/init.d/postfix start
/etc/init.d/postfix stop
/etc/init.d/postfix restart

Also, I tried this: "telnet localhost smtp", and get this error:
telnet: Unable to connect to remote host: Connection refused
I tried "telnet localhost", without the stmp, and get the same error:

Files on my system, that I know I configure, but dont fully understand:
# /etc/hosts
##############      localhost   debian  hoghost mailhost

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

# /etc/resolv.conf

# /etc/postfix/
# See /usr/share/postfix/ for a commented, more complete version

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

myhostname = debian
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = $mydomain $myhostname localhost.$mydomain
relayhost =
mynetworks =
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


   There is step-by-step guide to set up Linux Debian Postfix
or the Mailman with Postfix



Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tonguerooAuthor Commented:
Still cant postfix working.

Im thinking  about now trying Exim.  I heard that was pretty easy to set up.  What do you guys think?

   Exim is good. Easy to config and built-in spam filter. You can download from

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.


Head over to & check out the article "Set up a basic e-mail server with Postfix as the MTA"

tonguerooAuthor Commented:
Okay, Im trying Exim, and it looks like I can reveive mail locally.  I want to email the to the rest of the world though.  I cant email to the rest of the world.

I know that my dsl smtp is :

This all boils down to getting my perl script to work so that user's can submit a form on my website and get auto respond email.

tonguerooAuthor Commented:
Im still havent trouble sending mail to remote addresses.

This is what I type:
debian:/# exim4 -v -odf
testing testing... 123...

This is what I get:
  <= root@debian U=root P=local S=251
R: nonlocal for
  ** R=nonlocal: Mailing to remote domains not supported
  <= <> R=1CRFtM-00020F-Vd U=Debian-exim P=local S=1028
R: system_aliases for root@debian
R: system_aliases for tung@debian
R: userforward for tung@debian
R: procmail for tung@debian
R: maildrop for tung@debian
R: local_user for tung@debian
T: appendfile for tung@debian
  => tung <root@debian> R=local_user T=mail_spool

So, I know the error:
"  ** R=nonlocal: Mailing to remote domains not supported"
But dunno how to get rid of it.....


   You probably need to reconfig exim4 to check "smarthost" or something like that.
# dpkg-reconfigure exim4

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Email Protocols

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.