SendMail not working in CentOs 6.4

Posted by Kane on Server Fault See other posts from Server Fault or by Kane
Published on 2013-08-14T09:26:02Z Indexed on 2013/10/30 22:00 UTC
Read the original article Hit count: 277

Filed under:
|
|

I am trying to send e-mails from my CentOS 6.4 but it does not work. My knowledge about servers is quite limited, so I hope someone can help me. Here is what I did:

  1. First i tried to send an email using the "mail" command, but it was not in the OS so I installed it.

    # yum install mailx
    
  2. After that, I tried sending an email using the "mail" command, but it did not send anything. I checked it on the internet and I realized I needed an e-mail server like sendmail, so I installed it.

    # yum install sendmail sendmail-cf sendmail-doc sendmail-devel
    
  3. After that, I configured it following some tutorials. First, sendmail.mc file.

    # vi /etc/mail/sendmail.mc
    
  4. Commented out the next line:

    BEFORE
    # DAEMON_OPTIONS('Port=smtp, Name=MTA') dnl
    
    AFTER
    # dnl DAEMON_OPTIONS('Port=smtp, Name=MTA') dnl
    
  5. Check that the next lines are correct:

    # FEATURE(`virtusertable', `hash -o /etc/mail/virtusertable.db')dnl
    # ...
    # FEATURE(use_cw_file)dnl
    # ...
    # FEATURE(`access_db', `hash -T<TMPF> -o /etc/mail/access.db')dnl
    
  6. Update sendmail.cf

    # m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
    
  7. Open the port 25 adding the proper line in the iptables file

    # vi /etc/sysconfig/iptables
    
    # -A INPUT -m state --state NEW -m tcp --dport 25 -j ACCEPT
    
  8. restart iptables and sendmail

    # service iptables restart
    # service sendmail restart
    

So i thought that would be ok, but when i tried:

    # mail '[email protected]'
    # Subject: test subject
    # test content
    #.

I checked the mail log:

    # vi /var/log/maillog

And that is what I found:

    Aug 14 17:36:24 dev-admin-test sendmail[20682]: r7D8RItS019578: 
    to=<[email protected]>, ctladdr=<[email protected]> (0/0), 
    delay=1+00:09:06, xdelay=00:00:00, mailer=esmtp, pri=2460500, relay=alt4.gmail-
    smtp-in.l.google.com., dsn=4.0.0, stat=Deferred: Connection timed out with 
    alt4.gmail-smtp-in.l.google.com.

I do not understand why there is a connection time out. Am I missing something? Can anyone help me, please?

Thank you.

© Server Fault or respective owner

Related posts about centos

Related posts about smtp