Mail Server Can't Receive Email But Can Send Email - Postfix, Dovecot, Postgresql

July 20, 2016 530 views
Messaging PostgreSQL Networking

I have server where I want to set up a mail server to let me receive and send email from my domain. I'm currently having a problem where while I am can not receive mails. Sending emails works perfect.

I'm going off of this script, which shows how to configure a mail server using Postfix, Dovecot, and using Postgresql as the backend (https://gist.github.com/solusipse/7ed8e1da104baaee3f05).


    relay_domains =
    virtual_alias_maps = proxy:pgsql:/etc/postfix/virtual_alias_maps.cf
    virtual_mailbox_domains = proxy:pgsql:/etc/postfix/virtual_mailbox_domains.cf
    virtual_mailbox_maps = proxy:pgsql:/etc/postfix/virtual_mailbox_maps.cf
    virtual_mailbox_base = /home/vmail
    virtual_mailbox_limit = 512000000
    virtual_minimum_uid = 5000
    virtual_transport = virtual
    virtual_uid_maps = static:5000
    virtual_gid_maps = static:5000
    local_transport = virtual
    local_recipient_maps = 
    transport_maps = hash:/etc/postfix/transport

    smtpd_sasl_auth_enable = yes
    smtpd_sasl_type = dovecot
    smtpd_sasl_path = private/auth
    smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
    smtpd_sasl_security_options = noanonymous
    smtpd_sasl_tls_security_options = 
    smtpd_tls_auth_only = yes
    smtpd_tls_cert_file = /etc/ssl/private/server.crt
    smtpd_tls_key_file = /etc/ssl/private/server.key
    smtpd_sasl_local_domain = 
    broken_sasl_auth_clients = yes
    smtpd_tls_loglevel = 1
    html_directory = /usr/share/doc/postfix/html
    queue_directory = /var/spool/postfix
    mydestination = localhost


    protocols = imap
    auth_mechanisms = plain
    passdb {
        driver = sql
        args = /etc/dovecot/dovecot-sql.conf
    userdb {
        driver = sql
        args = /etc/dovecot/dovecot-sql.conf
    service auth {
        unix_listener /var/spool/postfix/private/auth {
        group = postfix
        mode = 0660
        user = postfix
        user = root
    mail_home = /home/vmail/%d/%u
    mail_location = maildir:~
    ssl_cert = </etc/ssl/private/server.crt
    ssl_key = </etc/ssl/private/server.key


    Apr 17 19:46:18 v22015072919626549 postfix/smtpd[8837]: connect from ***
    Apr 17 19:46:18 v22015072919626549 postfix/smtpd[8837]: 62D6A3E0DC9: client=***
    Apr 17 19:46:18 v22015072919626549 postfix/cleanup[8843]: 62D6A3E0DC9: message-id=***
    Apr 17 19:46:18 v22015072919626549 postfix/smtpd[8837]: disconnect from ***
    Apr 17 19:46:18 v22015072919626549 postfix/qmgr[9001]: 62D6A3E0DC9: from=<***>, size=1160, nrcpt=1 (queue active)
    Apr 17 19:46:18 v22015072919626549 postfix/virtual[8844]: 62D6A3E0DC9: to=<***>, relay=virtual, delay=0.05, delays=0.01/0.01/0/0.02, dsn=2.0.0, status=sent (delivered to maildir)
    Apr 17 19:46:18 v22015072919626549 postfix/qmgr[90
```01]: 62D6A3E0DC9: removed
  • @speamy - Your mail log shows that it delivered to maildir. Send yourself mail, then look at your maildir area for recently received files, which you can find using the following command line:

    find /var/mail -ctime 0 -type f

    Look at the contents of files in directories that have "cur" as the subdirectory.

  • Yes, I find the mail in this folder. How work the mapping so that i can call away this in my mail programme?

  • @speamy - From the command line, run the following and monitor the output (note where the output ends, or press return a few times to mark the end of the current output):

    tail -f /var/log/mail.err /var/log/mail.log /var/log/dovecot.log 

    From your external email reader program, try to read your inbox as you normally would. Copy and post any new output that shows up as you try to read your inbox.

1 Answer

@speamy - You need to use a mail reader that can be configured to use IMAP (port 143) or IMAPS (port 993). For instance, Thunderbird can be configured this way. Make one or both of those imap ports available through your firewall. Good luck.

  • Yes, but in Thunderbird is the inbox empty. I believe this mapping on the server not properly work

Have another answer? Share your knowledge.