Cant make PMG output emails

tiagoadp

Member
Oct 9, 2022
12
0
6
Well my current problem is that i have an virtualmin inside on a 10.10.0.0/16 network and an pmg on the same network, the pmg is reciving the email nicely and transporting to the virtualmin, but the problem is when some1 tryes to send an email from virtualmin it get this error:

The internal domain user is user@mydomain.com

Failed to send mail : SMTP command rcpt to: <user@gmail.com> failed : 554 5.7.1 <user@gmail.com>: Relay access denied


Also this mydomain.com can receive emails without problem filtered trought PMG, also the config on this postfix/virtualmin is as follows:

# See /usr/share/postfix/main.cf.dist for a commented, more complete version

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
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

alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
relayhost = pmgrelayip:26
mynetworks = 10.10.0.0/16
recipient_delimiter = +

compatibility_level = 2

virtual_alias_maps = hash:/etc/postfix/virtual
sender_bcc_maps = hash:/etc/postfix/bcc
sender_dependent_default_transport_maps = hash:/etc/postfix/dependent
mailbox_command = /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME
home_mailbox = Maildir/
smtpd_sasl_auth_enable = yes
smtpd_tls_security_level = may
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination
smtp_tls_security_level = dane
smtp_dns_support_level = dnssec
smtp_host_lookup = dns
mailbox_size_limit = 0
allow_percent_hack = no
resolve_dequoted_address = no
tls_server_sni_maps = hash:/etc/postfix/sni_map
mynetworks_style = subnet

Also the configs on the PMG (side note port 25 external and 26 internal):

brave_8sjixOjVpl.pngbrave_aKdS1A0Vbh.pngbrave_JfcER8EzYX.pngbrave_lDJaLh53pF.png

Im asking for help because i´m strugling like 5 days on this now, also if any other info is need just ask i will share gladly...

tnx for your time.
 
Last edited:
Please post the logs for such a mail (/var/log/syslog) ... else it's not really possible to see where the issue might be

If I have to guess:
The internal domain user is user@mydomain.com
vs.

554 5.7.1 <user@gmail.com>: Relay access denied​


the mail seems to be sent _to_ user@gmail.com - and since this is not in your relay domains (and it would not make sense to add gmail as relay domain (your PMG is not the MX for gmail)

if you want to receive mail for mydomain.com - add mydomain.com as relay domain, and make the mx-record of mydomain.com point to your PMG

I hope this helps!
 
Please post the logs for such a mail (/var/log/syslog) ... else it's not really possible to see where the issue might be

If I have to guess:

vs.


the mail seems to be sent _to_ user@gmail.com - and since this is not in your relay domains (and it would not make sense to add gmail as relay domain (your PMG is not the MX for gmail)

if you want to receive mail for mydomain.com - add mydomain.com as relay domain, and make the mx-record of mydomain.com point to your PMG

I hope this helps!
I can receive the mydomain.com is on the relay... The problem is I can't send emails, I can't add Gmail as a relay if not I will have to add every single domain existent as a relay it should use the mx of the domains to send the mail right? I didn't get the outgoing stuff... It should try to send the mail to the external MX... No?
 
Please post the logs for this mail from PMG's side (anonymize things so that it's still clear which is which) - else I cannot tell where the issue is

Thanks!
 
The syslog isn´t logging those actions, can´t find what file it is logging those relay rejection.
 
The syslog isn´t logging those actions, can´t find what file it is logging those relay rejection.
Usually if the mail is rejected by PMG it will log this - also if PMG cannot send the message to its destination it will log this.

Does the mail go to PMG at all?
 
Seems that the problem is on the virtualmin side, postfix isn´t sending to pmg... And yes it is trying to use localhost instead of smtp relay to send it, dunno why, i will analyze what is happening on virtualmin side...

May 12 11:25:27 painel dovecot: imap-login: Login: user=<mail@mydomain.com>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=346576, secured, session=<46Rc4H/7iKd/AAAB>
May 12 11:25:27 painel postfix/smtpd[345700]: connect from localhost[127.0.0.1]
May 12 11:25:27 painel postfix/smtpd[345700]: NOQUEUE: reject: RCPT from localhost[127.0.0.1]: 554 5.7.1 <user@gmail.com>: Relay access denied; from=<mail@mydomain.com> to=<user@gmail.com> proto=SMTP helo=<painel.mydomain.com>
May 12 11:25:27 painel postfix/smtpd[345700]: using backwards-compatible default setting smtpd_relay_before_recipient_restrictions=no to reject recipient "user@gmail.com" from client "localhost[127.0.0.1]"
May 12 11:25:27 painel postfix/smtpd[345700]: lost connection after RCPT from localhost[127.0.0.1]
May 12 11:25:27 painel postfix/smtpd[345700]: disconnect from localhost[127.0.0.1] helo=1 mail=1 rcpt=0/1 commands=2/3
May 12 11:25:27 painel dovecot: imap(mail@mydomain.com)<346576><46Rc4H/7iKd/AAAB>: Disconnected: Connection closed (list finished 0.068 secs ago) in=47 out=940 deleted=0 expunged=0 trashed=0 hdr_count=0 hdr_bytes=0 body_count=0 body_bytes=0
 
Found it, the problem was with postfix on virtualmin, mynetworks = 10.10.0.0/16 i needed to put the 127.0.0.0/8 on it, so i can relay locally first and then externally... now it sends, but im getting a DMARC problem on gmail trought PMG, i will try to fix by myself first...
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!