1 (edited by Martin184 2022-07-04 22:28:04)

Topic: [HELP] No incoming mail.

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 1.6.0
- Deployed with iRedMail Easy or the downloadable installer? Downloadable installer
- Linux/BSD distribution name and version: Ubuntu 20.04
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? No
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

Hi guys,
I'm facing a issue, i've just set up a new server and installed iRedMail on it (ubuntu 20.04).
Everything is working fine, I can access webmail by browser, send emails locally and to other domains such as gmail.com.
The issue is that I can NOT receive emails from gmail... It(gmail) gives me the following error in a email response:

554 5.7.1 <user1@mydomain.com>: Relay access denied

At this point I've tried so many potential fixes and as a newbie I'm kinda lost at this point..
tail -f /var/log/maillog doesn't show anything interesting.

I did come across this error while doing the telnet test thingy:

451 4.7.1 <user1@mydomain.com>: Recipient address rejected: Intentional policy rejection, please try again later

And here is my postconf -n:

alias_database = hash:/etc/postfix/aliases
alias_maps = hash:/etc/postfix/aliases
allow_min_user = no
allow_percent_hack = no
biff = no
body_checks = pcre:/etc/postfix/body_checks.pcre
command_directory = /usr/sbin
compatibility_level = 2
content_filter = smtp-amavis:[127.0.0.1]:10024
daemon_directory = /usr/lib/postfix/sbin
data_directory = /var/lib/postfix
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
disable_vrfy_command = yes
dovecot_destination_recipient_limit = 1
enable_long_queue_ids = yes
enable_original_recipient = no
header_checks = pcre:/etc/postfix/header_checks
inet_interfaces = all
inet_protocols = all
lmtp_tls_mandatory_protocols = !SSLv2 !SSLv3
lmtp_tls_protocols = !SSLv2 !SSLv3
mail_owner = postfix
mailq_path = /usr/bin/mailq
message_size_limit = 15728640
mlmmj_destination_recipient_limit = 1
mydestination = localhost.$mydomain, localhost, $mydomain
mydomain = mail.mydomain.com
myhostname = mail.mydomain.com
mynetworks = 127.0.0.0/8 192.168.1.0/24
myorigin = mail.mydomain.com
newaliases_path = /usr/bin/newaliases
postscreen_access_list = permit_mynetworks cidr:/etc/postfix/postscreen_access.cidr
postscreen_blacklist_action = drop
postscreen_dnsbl_action = drop
postscreen_dnsbl_reply_map = texthash:/etc/postfix/postscreen_dnsbl_reply
postscreen_dnsbl_sites = zen.spamhaus.org=127.0.0.[2..11]*3 b.barracudacentral.org=127.0.0.2*2
postscreen_dnsbl_threshold = 2
postscreen_dnsbl_whitelist_threshold = -2
postscreen_greet_action = drop
proxy_read_maps = $canonical_maps $lmtp_generic_maps $local_recipient_maps $mydestination $mynetworks $recipient_bcc_maps $recipient_canonical_maps $relay_domains $relay_recipient_maps $relocated_maps $sender_bcc_maps $sender_canonical_maps $smtp_generic_maps $smtpd_sender_login_maps $transport_maps $virtual_alias_domains $virtual_alias_maps $virtual_mailbox_domains $virtual_mailbox_maps $smtpd_sender_restrictions $sender_dependent_relayhost_maps
queue_directory = /var/spool/postfix
recipient_bcc_maps = proxy:mysql:/etc/postfix/mysql/recipient_bcc_maps_user.cf proxy:mysql:/etc/postfix/mysql/recipient_bcc_maps_domain.cf
recipient_delimiter = +
relay_domains = $mydestination proxy:mysql:/etc/postfix/mysql/relay_domains.cf
sender_bcc_maps = proxy:mysql:/etc/postfix/mysql/sender_bcc_maps_user.cf proxy:mysql:/etc/postfix/mysql/sender_bcc_maps_domain.cf
sender_dependent_relayhost_maps = proxy:mysql:/etc/postfix/mysql/sender_dependent_relayhost_maps.cf
sendmail_path = /usr/sbin/sendmail
setgid_group = postdrop
show_user_unknown_table_name = no
smtp-amavis_destination_recipient_limit = 1
smtp_tls_CAfile = $smtpd_tls_CAfile
smtp_tls_CApath = /etc/ssl/certs
smtp_tls_loglevel = 1
smtp_tls_mandatory_protocols = !SSLv2 !SSLv3
smtp_tls_note_starttls_offer = yes
smtp_tls_protocols = !SSLv2 !SSLv3
smtp_tls_security_level = may
smtpd_command_filter = pcre:/etc/postfix/command_filter.pcre
smtpd_data_restrictions = reject_unauth_pipelining
smtpd_end_of_data_restrictions = check_policy_service inet:127.0.0.1:7777
smtpd_helo_required = yes
smtpd_helo_restrictions = permit_mynetworks permit_sasl_authenticated check_helo_access pcre:/etc/postfix/helo_access.pcre reject_non_fqdn_helo_hostname reject_unknown_helo_hostname
smtpd_recipient_restrictions = reject_non_fqdn_recipient reject_unlisted_recipient check_policy_service inet:127.0.0.1:7777 permit_mynetworks permit_sasl_authenticated reject_unauth_destination check_policy_service inet:127.0.0.1:12340
smtpd_reject_unlisted_recipient = yes
smtpd_reject_unlisted_sender = yes
smtpd_sasl_path = private/dovecot-auth
smtpd_sasl_type = dovecot
smtpd_sender_login_maps = proxy:mysql:/etc/postfix/mysql/sender_login_maps.cf
smtpd_sender_restrictions = reject_non_fqdn_sender reject_unlisted_sender permit_mynetworks permit_sasl_authenticated check_sender_access pcre:/etc/postfix/sender_access.pcre reject_unknown_sender_domain
smtpd_tls_CAfile = /etc/letsencrypt/live/mail.mydomain.com/chain.pem
smtpd_tls_CApath = /etc/ssl/certs
smtpd_tls_cert_file = /etc/letsencrypt/live/mail.mydomain.com/cert.pem
smtpd_tls_dh1024_param_file = /etc/ssl/dh2048_param.pem
smtpd_tls_dh512_param_file = /etc/ssl/dh512_param.pem
smtpd_tls_exclude_ciphers = aNULL, eNULL, EXPORT, DES, RC4, MD5, PSK, aECDH, EDH-DSS-DES-CBC3-SHA, EDH-RSA-DES-CDC3-SHA, KRB5-DE5, CBC3-SHA
smtpd_tls_key_file = /etc/letsencrypt/live/mail.mydomain.com/privkey.pem
smtpd_tls_loglevel = 1
smtpd_tls_mandatory_protocols = !SSLv2 !SSLv3
smtpd_tls_protocols = !SSLv2 !SSLv3
smtpd_tls_security_level = may
swap_bangpath = no
tls_random_source = dev:/dev/urandom
transport_maps = proxy:mysql:/etc/postfix/mysql/transport_maps_user.cf proxy:mysql:/etc/postfix/mysql/transport_maps_maillist.cf proxy:mysql:/etc/postfix/mysql/transport_maps_domain.cf
unknown_local_recipient_reject_code = 550
virtual_alias_domains =
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql/virtual_alias_maps.cf proxy:mysql:/etc/postfix/mysql/domain_alias_maps.cf proxy:mysql:/etc/postfix/mysql/catchall_maps.cf proxy:mysql:/etc/postfix/mysql/domain_alias_catchall_maps.cf
virtual_gid_maps = static:2000
virtual_mailbox_base = /var/vmail
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql/virtual_mailbox_domains.cf
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql/virtual_mailbox_maps.cf
virtual_minimum_uid = 2000
virtual_transport = dovecot
virtual_uid_maps = static:2000

sudo ufw status

To                         Action      From
--                         ------      ----
OpenSSH                    ALLOW       Anywhere                  
Nginx Full                 ALLOW       Anywhere                  
80/tcp                     ALLOW       Anywhere                  
443/tcp                    ALLOW       Anywhere                  
25/tcp                     ALLOW       Anywhere                  
587/tcp                    ALLOW       Anywhere                  
143/tcp                    ALLOW       Anywhere                  
993/tcp                    ALLOW       Anywhere                  
110/tcp                    ALLOW       Anywhere                  
995/tcp                    ALLOW       Anywhere                  
25                         ALLOW       Anywhere                  
Postfix                    ALLOW       Anywhere                  
2525                       ALLOW       Anywhere                  
OpenSSH (v6)               ALLOW       Anywhere (v6)             
Nginx Full (v6)            ALLOW       Anywhere (v6)             
80/tcp (v6)                ALLOW       Anywhere (v6)             
443/tcp (v6)               ALLOW       Anywhere (v6)             
25/tcp (v6)                ALLOW       Anywhere (v6)             
587/tcp (v6)               ALLOW       Anywhere (v6)             
143/tcp (v6)               ALLOW       Anywhere (v6)             
993/tcp (v6)               ALLOW       Anywhere (v6)             
110/tcp (v6)               ALLOW       Anywhere (v6)             
995/tcp (v6)               ALLOW       Anywhere (v6)             
25 (v6)                    ALLOW       Anywhere (v6)             
Postfix (v6)               ALLOW       Anywhere (v6)             
2525 (v6)                  ALLOW       Anywhere (v6) 

netstart -tulpn

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 127.0.0.1:7779          0.0.0.0:*               LISTEN      1523/python3        
tcp        0      0 0.0.0.0:995             0.0.0.0:*               LISTEN      819/dovecot         
tcp        0      0 127.0.0.1:10024         0.0.0.0:*               LISTEN      20950/amavisd-new ( 
tcp        0      0 127.0.0.1:10025         0.0.0.0:*               LISTEN      28841/master        
tcp        0      0 127.0.0.1:10026         0.0.0.0:*               LISTEN      20950/amavisd-new ( 
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      1025/mysqld         
tcp        0      0 0.0.0.0:587             0.0.0.0:*               LISTEN      28841/master        
tcp        0      0 127.0.0.1:10027         0.0.0.0:*               LISTEN      20950/amavisd-new ( 
tcp        0      0 127.0.0.1:10028         0.0.0.0:*               LISTEN      28841/master        
tcp        0      0 127.0.0.1:9998          0.0.0.0:*               LISTEN      20950/amavisd-new ( 
tcp        0      0 0.0.0.0:110             0.0.0.0:*               LISTEN      819/dovecot         
tcp        0      0 127.0.0.1:7790          0.0.0.0:*               LISTEN      891/uwsgi           
tcp        0      0 0.0.0.0:143             0.0.0.0:*               LISTEN      819/dovecot         
tcp        0      0 127.0.0.1:9999          0.0.0.0:*               LISTEN      835/php-fpm: master 
tcp        0      0 127.0.0.1:7791          0.0.0.0:*               LISTEN      895/uwsgi           
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      962/nginx: master p 
tcp        0      0 0.0.0.0:465             0.0.0.0:*               LISTEN      28841/master        
tcp        0      0 127.0.0.1:24242         0.0.0.0:*               LISTEN      819/dovecot         
tcp        0      0 127.0.0.1:12340         0.0.0.0:*               LISTEN      819/dovecot         
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      794/systemd-resolve 
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      910/sshd: /usr/sbin 
tcp        0      0 127.0.0.1:24            0.0.0.0:*               LISTEN      819/dovecot         
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      28841/master        
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      962/nginx: master p 
tcp        0      0 127.0.0.1:8125          0.0.0.0:*               LISTEN      2138/netdata        
tcp        0      0 127.0.0.1:4190          0.0.0.0:*               LISTEN      819/dovecot         
tcp        0      0 127.0.0.1:19999         0.0.0.0:*               LISTEN      2138/netdata        
tcp        0      0 127.0.0.1:7777          0.0.0.0:*               LISTEN      1523/python3        
tcp        0      0 0.0.0.0:993             0.0.0.0:*               LISTEN      819/dovecot         
tcp        0      0 127.0.0.1:7778          0.0.0.0:*               LISTEN      1523/python3        
tcp6       0      0 :::995                  :::*                    LISTEN      819/dovecot         
tcp6       0      0 :::587                  :::*                    LISTEN      28841/master        
tcp6       0      0 :::110                  :::*                    LISTEN      819/dovecot         
tcp6       0      0 :::143                  :::*                    LISTEN      819/dovecot         
tcp6       0      0 :::80                   :::*                    LISTEN      962/nginx: master p 
tcp6       0      0 :::465                  :::*                    LISTEN      28841/master        
tcp6       0      0 :::22                   :::*                    LISTEN      910/sshd: /usr/sbin 
tcp6       0      0 :::25                   :::*                    LISTEN      28841/master        
tcp6       0      0 :::443                  :::*                    LISTEN      962/nginx: master p 
tcp6       0      0 ::1:8125                :::*                    LISTEN      2138/netdata        
tcp6       0      0 :::993                  :::*                    LISTEN      819/dovecot         
udp        0      0 127.0.0.1:8125          0.0.0.0:*                           2138/netdata        
udp        0      0 127.0.0.53:53           0.0.0.0:*                           794/systemd-resolve 
udp6       0      0 ::1:8125                :::*                                2138/netdata 

talf -f /var/log/maillog

Jul  4 11:30:16 mail postfix/postscreen[36493]: CONNECT from [162.142.125.221]:50232 to [198.54.123.218]:25
Jul  4 11:30:16 mail postfix/postscreen[36493]: cache btree:/var/lib/postfix/postscreen_cache full cleanup: retained=7 dropped=0 entries
Jul  4 11:30:22 mail postfix/postscreen[36493]: PASS NEW [162.142.125.221]:50232
Jul  4 11:30:23 mail postfix/smtpd[36498]: connect from scanner-25.ch1.censys-scanner.com[162.142.125.221]
Jul  4 11:30:23 mail postfix/smtpd[36498]: Anonymous TLS connection established from scanner-25.ch1.censys-scanner.com[162.142.125.221]: TLSv1.3 with cipher TLS_CHACHA20_POLY1305_SHA256 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
Jul  4 11:30:23 mail postfix/smtpd[36498]: lost connection after STARTTLS from scanner-25.ch1.censys-scanner.com[162.142.125.221]
Jul  4 11:30:23 mail postfix/smtpd[36498]: disconnect from scanner-25.ch1.censys-scanner.com[162.142.125.221] ehlo=1 starttls=1 commands=2
Jul  4 11:33:43 mail postfix/anvil[36500]: statistics: max connection rate 1/60s for (smtpd:162.142.125.221) at Jul  4 11:30:23
Jul  4 11:33:43 mail postfix/anvil[36500]: statistics: max connection count 1 for (smtpd:162.142.125.221) at Jul  4 11:30:23
Jul  4 11:33:43 mail postfix/anvil[36500]: statistics: max cache size 1 at Jul  4 11:30:23

Would greatly appreciate some help..

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: [HELP] No incoming mail.

Did you get this "Relay access denied" no matter sent from Gmail / Outlook / Yahoo / ... or any other mail server?

3

Re: [HELP] No incoming mail.

ZhangHuangbin wrote:

Did you get this "Relay access denied" no matter sent from Gmail / Outlook / Yahoo / ... or any other mail server?

Get the same error or similar error from all other mail servers

4

Re: [HELP] No incoming mail.

Solved it.

For me it was a DNS issue, I had multiple MX records from NameCheap in my DNS settings.
I removed all of the NameCheap ones and double checked the MX records I had to set for my mail server.

After 20-30 minutes I was able to receive emails from everywhere!