Recieve Email from outside to linux

Posted on 2009-12-29
Last Modified: 2013-11-30
I need the easiest solution possible. I do not need a complex setup or even the ability to send mails.

I need a way to receive email into my linux machine. so say its if from outlook I sent to


I want to recieve it into my shell.

I tried configuring postfix but no luck, I have never done this and the tutorials are not helping.

Could someone please be kind enough to walk me through this? Thanks
Question by:GTsafas
    LVL 29

    Expert Comment

    I dont use postfix

    but if  you want, i can help you with sendmail

    its easy and straight forward

    yum install sendmail

    after install it

    go to

    cd /etc/mail

    look for this line

    DAEMON_OPTIONS(`Port=smtp,Addr=, Name=MTA')dnl

    and make it like this

    DAEMON_OPTIONS(`Port=smtp, Name=MTA')dnl

    now Save the file

    now restart sendmail

    service sendmail restart

    now if you sent email like this

    TO : root@ip-of-your mail server

    you will received the email , if not then you have to use a domain name ( but i am sure without domain name you will be able to sendmail to this server)

    also make sure , from your pc, you can telnet to the server like this

    telnet ip-of-your-server 25

    if its connected that means your server is ready to received email

    to allow other user to received email you need to add them in /etc/aliases file

    but i never tryed without domain, but it should work, let me know

    LVL 4

    Expert Comment

    Will need to cange the following line in the conf file to accept email:

    mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain  Could add the IP address to this line also.
    mynetworks =,  (change to your localnetwork
    myorigin = $mydomain
    mydomain = <your domain>.com  

    Also, if you are running a firewall (service iptables status), you will need to run this command to allow port 25:

    iptables -I RH-Firewall-1-INPUT 6 -m state --state new -m tcp -ptcp --dport 25 -j ACCEPT

    service iptables save

    Author Comment


    No luck, I cannot get to port 25

    what is sendmail-cf?

    Shutting down sm-client:                                   [  OK  ]
    Shutting down sendmail:                                    [  OK  ]
    Package sendmail-cf is required to update configuration.   [WARNING]
    Starting sendmail:                                         [  OK  ]
    Starting sm-client:                                        [  OK  ]


    I tried everything there aside from the iptables command which returned the following

    # iptables -I RH-Firewall-1-INPUT 6 -m state --state new -mtcp -ptcp --dport 25 -j ACCEPT
    iptables v1.4.5: unknown protocol `-ptcp' specified

    I modified it to

    # iptables -A RH-Lokkit-0-50-INPUT -p tcp -m tcp --dport 25 --syn -j ACCEPT

    and recieved

    iptables: No chain/target/match by that name
    LVL 29

    Accepted Solution

    First off all
    you cant use posfix and sendmail at the same time

    so chose what  you want to run

    No luck, I cannot get to port 25:
     if port 25 is not open then you can received email on the mail server

    what is sendmail-cf? is a file name it will be on /etc/mail directory

    but you dont have this one

    so donwload this  by

    yum install sendmail-cf

    it will install sendmail-cf packages


    as the other Experts said, you need to look into iptables rules

    whats the output of iptables ??

    iptables -L    [ show the out put here ]

    whats the output of your

    cat /etc/sysconfig/iptables        ??

    iptables rules could be 2 way : -A or -RH

    so show the output of both iptables here

    Author Comment

    I have postfix disabled, here is my iptables output

    Chain INPUT (policy ACCEPT)
    target     prot opt source               destination

    Chain FORWARD (policy ACCEPT)
    target     prot opt source               destination

    Chain OUTPUT (policy ACCEPT)
    target     prot opt source               destination

    cat /etc/sysconfig/iptables      is empty, I have firewall disabled btw so I dont think iptables matters.

    Author Comment

    so after i installed

    yum install sendmail-cf

    I am able to telnet on 25,

    However when I send mail to my linux user @ ip I am not getting it.

    I also cannot telnet to 110
    LVL 29

    Expert Comment

    I am able to telnet on 25 :  thats means its now working as mail server
    However when I send mail to my linux user @ ip I am not getting it. :  this is i have little bit of doubt, i never tryed to mail an IP address.

    Sent an email to your root@ip-of-server   ( not user@ip-of-server)

    and look at log  /var/log/messages
     you can look at real time by this command

    tail -f /var/log/messages

    see if you see any entry or error after sending email to root@ip-of-server

    can not you use a domain ??
    LVL 29

    Expert Comment

    i think root@ , will not work

    you cant sent an email to an ip directly

    have a look to this one

    in google type : "sending email to an ip address"

    you might have to use [ ] or ... i dont know i will try to find out
    LVL 29

    Expert Comment

    From linux to linux i can sent email like this

    cat /etc/hosts | mail -s "test" root@[]

    but i dont know about outlook , but try like this root@[]

    also look at /var/log/maillog, see if you received any email or not


    if you received any email, in command line , you should see something like , You have mail in /var/spool/mail/root

    to check email for root : cat /var/spool/mail/root


    Author Comment

    I had to modify the config file to change every domain to my ip address.

    Also had to run /etc/mail/make afterwards

    Thanks so much
    LVL 29

    Expert Comment

    Good to see your problem solved

    and sorry i forgot to say, you need to execute make command if you modify anything in file

    anyway. good luck

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    Import PST to Exchange using Power Shell new-mailboximportrequest command, you can simply import the PST file into Exchange mailbox or archived. To know How to import PST into Exchange  2013 read the complete article.
    Local Continuous Replication is a cost effective and quick way of backing up Exchange server data. The following article describes the steps required to configure Local Continuous Replication. Also, the article tells you how to restore from a backup…
    In this video we show how to create an Address List in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Organization >> Ad…
    In this Micro Video tutorial you will learn the basics about Database Availability Groups and How to configure one using a live Exchange Server Environment. The video tutorial explains the basics of the Exchange server Database Availability grou…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now