4iffir
By:
4iffir

Postfix receive email from outside not working

September 20, 2014 15.9k views

Hi. This is my main.cf from postfix:

queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
mail_owner = postfix
myhostname = mail.almatyschool.su
mydomain = almatyschool.su
myorigin = $mydomain
inet_interfaces = all
inet_protocols = ipv4
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
unknown_local_recipient_reject_code = 550
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
home_mailbox = Maildir/
smtpd_banner = $myhostname ESMTP
debug_peer_level = 2
debugger_command =
     PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
     ddd $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.6.6/samples
readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES

[commented area]
SASL configuration

smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
smtpd_client_restrictions =
    permit_mynetworks,
    reject_unknown_client,
    permit
smtpd_recipient_restrictions =
    permit_mynetworks,
    permit_auth_destination,
    permit_sasl_authenticated,
    reject

TLS configuration
[/commented area end]



smtpd_use_tls = yes
smtpd_tls_key_file = /etc/pki/tls/private/ssl.key
smtpd_tls_cert_file = /etc/pki/tls/cert/ssl.crt
smtpd_tls_loglevel = 3
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
tls_random_source = dev:/dev/urandom

OS: Centos 6.5
iptables disabled

postfix+dovecot.

I can send email, but can't receive from outside, if i write

echo "This is only a test" | mail -s "Test email sent to local root user" admin

i receive email. Please, help.

3 comments
  • Hi, do you see any errors in postfix's error log?

    sudo tail /var/log/maillog
    
  • when you say "receive email from outside not working...", what email server have you sent from? Gmail? Yahoo?

    The reason I ask is because I had a similar incident recently: I could send mail to myself from my own email addresses on my server...and those mails would show up in my inbox.

    However, anything from gmail was not landing in my inbox. It would just vanish, and days later I would get notices from gmail saying they could not deliver the email.

    After some investigation, it turns out my SSL cert was not set up correctly for email.
    I used this tutorial:
    http://arstechnica.com/information-technology/2014/03/taking-e-mail-back-part-2-arming-your-server-with-postfix-dovecot/#image-6

    and then suddenly all of those un-delivered emails started pouring into my inbox. Apparently gmail will refuse to deliver if the do not trust the SSL on the server.

  • Hello there, I have used this tutorial and I am still not getting my emails they bounce back
    I can send internally without a problem I am using a slightly different configuration because I am using mysql as my db.
    But that shouldn't be a problem because in sending the emails internally to "Virtual" domains and users they get delivered.

    Although I had a certificate signed by a recognized "Authority" the problem remains the same, I know that my IP was blacklisted and I don't know why they blacklisted it while I had it for nearly 5 years nobody else uses it except myself.
    But it got blacklisted in a couple of websites only the rest I was in the clear, so I wonder if Google is using one of these websites so emails to my domain names get bounced back.

    Any ideas please, that would be much appreciated.
    Regards

1 Answer

This solved it for me, for those searching the web for hours.

sudo vim /etc/postfix/main.cf
-- press i
-- go to inetinterfaces
-- set inet
interfaces to all
sudo service postfix restart

Have another answer? Share your knowledge.