Relay access denied when using SMTP to external recipients

Discussion in 'Installation/Configuration' started by Kamran Shah, Oct 10, 2005.

  1. falko

    falko Super Moderator ISPConfig Developer

    Please start saslauthd:
    /etc/init.d/saslauthd start
  2. Desp

    Desp Member

    Postfix Relay access denied !

    Please some help before losing my mind ! :mad:
    I have setup postfix with smtp/imap and using squirrelmail on ubuntu . The problem is that I cant send emails outside the box getting the error Relay access denied . have tested many ways to solve this problem with no luck , The only good thing that happend is that the error msg disapeard but the problem remained . I have added my Wan ip to my networks =
    take a look at my + /etc/hosts and logs :

    smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
    biff = no

    # appending .domain is the MUA's job.
    append_dot_mydomain = no

    # Uncomment the next line to generate "delayed mail" warnings
    #delay_warning_time = 4h

    readme_directory = /usr/share/doc/postfix

    # TLS parameters
    smtpd_tls_cert_file = /etc/ssl/certs/smtpd.crt
    smtpd_tls_key_file = /etc/ssl/private/smtpd.key
    smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
    smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

    # See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
    # information on enabling SSL in the smtp client.

    myhostname =
    alias_maps = hash:/etc/aliases
    alias_database = hash:/etc/aliases
    myorigin = /etc/mailname
    mydestination =,,, , localhost
    relayhost =
    mynetworks =,, [::ffff:]/104 [::1]/128
    mailbox_size_limit = 0
    recipient_delimiter = +
    inet_interfaces = all
    html_directory = /usr/share/doc/postfix/html
    home_mailbox = Maildir/
    mailbox_command =
    smtpd_sasl_local_domain =
    smtpd_sasl_auth_enable = yes
    broken_sasl_auth_clients = yes
    smtpd_recipient_restrictions = permit_sasl_authenticated permit_mynetworks reject_unauth_destination # I guess here is the problem but how to solve it !!
    smtp_tls_security_level = may
    smtpd_tls_security_level = may
    smtpd_tls_auth_only = no
    smtp_tls_note_starttls_offer = yes
    smtpd_tls_CAfile = /etc/ssl/certs/cacert.pem
    smtpd_tls_loglevel = 1
    smtpd_tls_received_header = yes
    smtpd_tls_session_cache_timeout = 3600s
    tls_random_source = dev:/dev/urandom

    /etc/hosts : # Added by NetworkManager localhost.localdomain localhost
    ::1 trinity localhost6.localdomain6 localhost6
    # The following lines are desirable for IPv6 capable hosts
    ::1 localhost ip6-localhost ip6-loopback
    fe00::0 ip6-localnet
    ff00::0 ip6-mcastprefix
    ff02::1 ip6-allnodes
    ff02::2 ip6-allrouters
    ff02::3 ip6-allhosts

    and mail.log

    Jan 18 18:50:20 trinity postfix/qmgr[12712]: 2CBF44A16AF: from=<[email protected]>, size=713, nrcpt=1 (queue active)
    Jan 18 18:50:41 trinity postfix/smtp[13262]: connect to[]:25: Connection timed out
    Jan 18 18:51:02 trinity postfix/smtp[13262]: connect to[]:25: Connection timed out
    Jan 18 18:51:23 trinity postfix/smtp[13262]: connect to[]:25: Connection timed out
    Jan 18 18:51:44 trinity postfix/smtp[13262]: connect to[]:25: Connection timed out
    Jan 18 18:52:05 trinity postfix/smtp[13262]: connect to[]:25: Connection timed out
    Jan 18 18:52:05 trinity postfix/smtp[13262]: 2CBF44A16AF: to=<[email protected]>, relay=none, delay=3351, delays=3246/0.01/105/0, dsn=4.4.1, status=deferred (connect to[]:25: Connection timed out)

    some more info:
    root@trinity:~# dig mx

    ; <<>> DiG 9.7.1-P2 <<>> mx
    ;; global options: +cmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 8061
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0

    ; IN MX

    ;; ANSWER SECTION: 3600 IN MX 10 3600 IN MX 0

    ;; Query time: 143 msec
    ;; SERVER:
    ;; WHEN: Tue Jan 18 18:58:46 2011
    ;; MSG SIZE rcvd: 59

    root@trinity:~# cat /etc/resolv.conf
    # Generated by NetworkManager
    domain lan
    search lan

    Thank you in advance !
  3. Desp

    Desp Member

    250-SIZE 10240000
    250 DSN
  4. falko

    falko Super Moderator ISPConfig Developer

    Does this happen just for Hotmail, or for all emails you send to remote servers?
    You can search for Hotmail here on the forums, there are a lot of threads already about this.
    Also, make sure that your server isn't blacklisted:
  5. Desp

    Desp Member

    Thank you for your respond Falko , it happen for all emails outside my box .
  6. Desp

    Desp Member

    It's blacklisted in 2 destinations :
    SORBS-DUHL LISTED Dynamic IP Addresses See: Detail
    Return codes were: 3600 234
    Spamhaus-ZEN LISTED Detail
    Return codes were: 900 265

    could this be the problem, I have conacted them to remove my ip .
  7. Desp

    Desp Member

    Finaly I found the problem was with my ISP , they blocked port 25 from sending emails :confused: now I have to use their SMTP insted .
    anyway I really thankfull for your help Falko .
    Last edited: Jan 20, 2011
  8. klaipedaville

    klaipedaville New Member

    I understand this post is a bit too old but I would like to say thank you to Torgny as his/her post gave me an idea. I had exactly the same problem and what saved me was entering my ISP's IP for "mynetworks" and it started to work. I am not sure though but it looks like my ISP has some slightly misconfigured parts in their Postfix. Could anyone also comment on IP for "mynetworks", please? Thanks!
  9. hklcf

    hklcf New Member

    [root@server ~]# postconf -n
    alias_database = hash:/etc/aliases
    alias_maps = hash:/etc/aliases
    body_checks = regexp:/etc/postfix/body_checks
    broken_sasl_auth_clients = yes
    command_directory = /usr/sbin
    config_directory = /etc/postfix
    content_filter = amavis:[]:10024
    daemon_directory = /usr/libexec/postfix
    data_directory = /var/lib/postfix
    debug_peer_level = 2
    header_checks = regexp:/etc/postfix/header_checks
    html_directory = no
    inet_interfaces = all
    inet_protocols = all
    mail_owner = postfix
    mailbox_size_limit = 0
    mailq_path = /usr/bin/mailq.postfix
    manpage_directory = /usr/share/man
    message_size_limit = 0
    mime_header_checks = regexp:/etc/postfix/mime_header_checks
    mydestination =, localhost, localhost.localdomain
    myhostname =
    mynetworks = [::1]/128
    nested_header_checks = regexp:/etc/postfix/nested_header_checks
    newaliases_path = /usr/bin/newaliases.postfix
    proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps
    queue_directory = /var/spool/postfix
    readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES
    receive_override_options = no_address_mappings
    relay_domains = mysql:/etc/postfix/
    relay_recipient_maps = mysql:/etc/postfix/
    relayhost =
    sample_directory = /usr/share/doc/postfix-2.6.6/samples
    sendmail_path = /usr/sbin/sendmail.postfix
    setgid_group = postdrop
    smtpd_client_restrictions = check_client_access mysql:/etc/postfix/
    smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, check_recipient_access mysql:/etc/postfix/, reject_unauth_destination
    smtpd_sasl_auth_enable = yes
    smtpd_sasl_authenticated_header = yes
    smtpd_sasl_path = private/auth
    smtpd_sasl_type = dovecot
    smtpd_sender_restrictions = check_sender_access mysql:/etc/postfix/
    smtpd_tls_cert_file = /etc/postfix/smtpd.cert
    smtpd_tls_key_file = /etc/postfix/smtpd.key
    smtpd_tls_security_level = may
    smtpd_use_tls = yes
    transport_maps = hash:/var/lib/mailman/data/transport-mailman, proxy:mysql:/etc/postfix/
    unknown_local_recipient_reject_code = 550
    virtual_alias_domains =
    virtual_alias_maps = proxy:mysql:/etc/postfix/, mysql:/etc/postfix/
    virtual_gid_maps = static:5000
    virtual_mailbox_base = /var/vmail
    virtual_mailbox_domains = proxy:mysql:/etc/postfix/
    virtual_mailbox_maps = proxy:mysql:/etc/postfix/
    virtual_transport = dovecot
    virtual_uid_maps = static:5000
    i can receive email but can't send out email...
  10. klaipedaville

    klaipedaville New Member

    I strongly suggest you study the mailbox_command in your configuration. If you have Procmail and it sounds you have it because you are on Ubuntu, you have to set this parameter first (it's absolutely mandatory to set) otherwise emails will not go anywhere.
    Removing this parameter won't help, unless you remove entire Procmail.

    The next option please, try setting your ISP's IP address in $mynetworks parameter and restart your posrfix. If it starts working then it will mean that either your ISP is not SASL authenticated or you have misconfigured your SASL. This simple test won't do any harm

  11. slayt12

    slayt12 New Member


    Make sure that
    is not in your setup unless you have a map in
  12. cristopher

    cristopher New Member

    Thanks for the information, It was really useful.
  13. Iztok

    Iztok New Member

    Squirrelmail on debian 8 perfect server

    smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, check_recipient_access mysql:/etc/postfix/

    #not work
    #smtpd_recipient_restrictions = permit_sasl_authenticated, reject_unauth_destination, check_recipient_access mysql:/etc/postfix/
  14. hakabe

    hakabe New Member

    mydestination =
    Have a good evening :)

Share This Page