Problems with sending and receiving mail on CentOS

Discussion in 'Server Operation' started by blainarm387, Nov 6, 2011.

  1. blainarm387

    blainarm387 New Member

    Hello there.

    I'm a first-time poster to this site, and I will gladly admit I'm a newbie when it comes to linux and configuring sites. I've done quite a bit of programming in PHP and Javascript, so I'm not completely clueless, but I have to confess to being a bit short on knowledge when it comes to configuring a server.

    I have a VPS with a Japanese hosting company, and they provide users with a standard installation using Cent OS 5.5. I went through the guide at http://bit.ly/aRRadF in order to configure it.

    For the most part, everything works just fine, though I decided to keep phpmyadmin as using cookies for authentication. However, I can't for the life of me get the mail server to work. I tried setting up Mozilla Thunderbird, but it says that it can't find the settings for my email account.

    So next, I tried using Squirrelmail. At first, it told me that it could not connect to the IMAP server. Logging in with a bad username/password combination told me that the login had failed, so I knew that it was working. After poking around a bit, I found that if you don't have a Maildir directory in the user's home directory, Squirrelmail won't work. I put one in, and it let me log in.

    But then, we have another problem. Sending mail to anyone other than myself doesn't work. The program doesn't give me any errors, but the mails don't get through. Sending mails from other accounts doesn't work either. A couple of days ago, I sent some test mails, and now, two days later, I'm getting error messages from Mailer-Daemon saying that the server refused all attempts to connect.

    Also--and here's the weird thing--when I send a mail to myself via Squirrelmail, it won't show up in my inbox. But then when I log in to my server via SSH and type mail, it shows up fine. But it then tells me that the mail is in the directory /var/spool/mail/[my username].

    Connecting to my IMAP server via Telnet seems to work, though I have no clue what to do from there.

    I really have no clue as to what is going on here. I have tried doing searches to find the answer for myself, but I really don't know what questions to ask.

    That's why I'm here.

    Anyway, if anyone can help me I'd really appreciate it.

    Warmest regards,

    Blain Armstrong
    Chiba, Japan
     
  2. jmerken

    jmerken New Member

    hi

    Hi Blain,

    can you reach the SMTP server from the CentOS server? It seems that the emails arent getting out so that would mean SMTP settings could be wrong..

    also make sure no firewall is blocking it. for example you can run iptables -F to flush the rules so you can test.

    you will probably find the SMTP settings from this Japanese provider on their help pages..

    e.g. I am with one.com and their settings are different :

    send.one.com:2525

    but it could be something different in your case so you need to find that out first:
    e.g.
    SMTP Server :mail.yourisp.net
    SMTP Port :25

    Good luck :)
    Jan
     
  3. blainarm387

    blainarm387 New Member

    Hi Jan.

    Thank you for replying. I think we might be getting closer to the source of the problem. I tried making a telnet connection to my server at port 25, but to no avail. A telnet connection to port 143 is working fine though.

    I actually ran system-config-securitylevel-tui, and it showed that the firewall was disabled. (When installing CentOS, there are no options for enabling/disabling the firewall). I also tried the command iptables -F, and nothing happened.

    I am starting to think that the SMTP server might be listening on a different port. How could I go about confirming this?
     
  4. blainarm387

    blainarm387 New Member

    I actually just run netstat -tap, and couldn't find anything for smtp or postfix. Here's what I got:


    Active Internet connections (servers and established)
    Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
    tcp 0 0 *:imaps *:* LISTEN 8001/dovecot
    tcp 0 0 *:pop3s *:* LISTEN 8001/dovecot
    tcp 0 0 localhost.localdomain:10024 *:* LISTEN 7985/amavisd (maste
    tcp 0 0 *:mysql *:* LISTEN 3893/mysqld
    tcp 0 0 *:pop3 *:* LISTEN 8001/dovecot
    tcp 0 0 localhost.local:dyna-access *:* LISTEN 4190/clamd
    tcp 0 0 *:imap *:* LISTEN 8001/dovecot
    tcp 0 0 localhost.localdomain:smtp *:* LISTEN 9332/master


    Any idea what's going on, and how to fix it?
     
  5. jmerken

    jmerken New Member

    I do see :
    tcp 0 0 localhost.localdomain:smtp *:* LISTEN 9332/master
    strange you cannot reach port 25 then..

    check your /etc/services file to see what port is linked to smtp

    what does service command show >> service --status-all | grep postfix

    maybe check the instructions shown in this link:

    http://www.linuxmail.info/postfix-smtp-server-howto-centos-6/
     
  6. blainarm387

    blainarm387 New Member

    OK, we seem to be making progress here. I tried reconfiguring the mail.cf file and now I can receive mail via Squirrelmail,which I couldn't do before.

    I tried running service --status-all | grep postfix like you said, and nothing got returned. (Dovecot is working fine).

    The changes I made to mail.cf didn't seem to help. Any idea why postfix might not be listening on port 25?
     
  7. falko

    falko Super Moderator Howtoforge Staff

    Postfix is listening only on localhost, no on all interfaces. Please set inet_interfaces to all in your main.cf and restart Postfix.
     
  8. blainarm387

    blainarm387 New Member

    I tried that. Several times, in fact. It doesn't seem to be working. Any idea why? I even searched for all instances of inet_interfaces in the file, and it only showed inet_interfaces = all along with the other three that are commented out. Is it possible that there's something else wrong?
     
  9. blainarm387

    blainarm387 New Member

    OK, I've found the problem.

    Basically, I'm using this service under a two-week trial period right now. After doing a little digging, I figured out that they block port 25 during the trial period. Once I'm a paying customer, the restriction will be lifted.

    A big thank-you to Jan and Falco for all your help. As they say over here, どうもありがとうございました。色々お世話になりました。m(_ _)m
     

Share This Page