2

I need that emails arriveds from an external email (example "user@external_domain.com"), to an email account on my server (example: "root@my_domain.com"), be forwarded to another external address (example: "end_destination@gmail.com"). But it not works and no errors on LOG files.

Domain addresses, emails and IPs changed just to maintain my client's privacy.

When sending a message from an external email, example user@external_domain.com, to an email account on my server, example: root@my_domain.com, it arrives correctly in the root email box.

Log below:

May 24 18:47:58 mail postfix/smtpd[1711]: connect from a4-salsa4-1.my_domain.com[62.14.x.x] 
May 24 18:47:58 mail postfix/smtpd[1711]: 6C776419DE: client=a4-salsa4-1.my_domain.com[62.14.x.x] 
May 24 18:47:58 mail postfix/cleanup[1715]: 6C776419DE: message-id=<5b07330dc328f5_720f3fc01a2314056420@a434gfdinter9.mail> 
May 24 18:47:58 mail postfix/qmgr[1415]: 6C776419DE: from=<exemplo user@external_domain.com>, size=2087, nrcpt=1 (queue active) 
May 24 18:47:58 mail postfix/smtpd[1711]: disconnect from a4-salsa4-1.my_domain.com[62.14.x.x] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5 
May 24 18:47:58 mail postfix/local[1716]: 6C776419DE: to=<root@my_domain.com>, relay=local, delay=0.07, delays=0.06/0.01/0/0, dsn=2.0.0, status=sent (delivered to mailbox) 
May 24 18:47:58 mail postfix/qmgr[1415]: 6C776419DE: removed

I want the all emails that arrived in "root" account (root@my_domain.com) to be forwarded to "end_destination@gmail.com", so I configured the routing.

Enabling forward (in the shell with as root user):

# echo "\ root end_destination@gmail.com"> ~ / .forward

With this setup for routing, emails sent from "user@external_domain.com" to email address "root@my_domain.com", arrive at the local mail account (at my vps), but do not arrive at "end_destination@gmail.com".

However the logs indicate that they have been sent to "end_destination@gmail.com", see below the log:

May 24 17:58:14 mail postfix/smtpd[32297]: connect from a4-salsa4-1.my_domain.com[62.14.x.x]
May 24 17:58:14 mail postfix/smtpd[32297]: 7A43B41A02: client=a4-salsa4-1.my_domain.com[62.14.x.x]
May 24 17:58:14 mail postfix/cleanup[32301]: 7A43B41A02: message-id=<5b072765eb5c6_8e23febd912113c830b6@a434gfdinter9.mail>
May 24 17:58:14 mail postfix/qmgr[30879]: 7A43B41A02: from=<user@external_domain.com>, size=2087, nrcpt=1 (queue active)
May 24 17:58:14 mail postfix/smtpd[32297]: disconnect from a4-salsa4-1.my_domain.com[62.14.x.x] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5
May 24 17:58:14 mail postfix/cleanup[32301]: 7FD4D41A08: message-id=<5b072765eb5c6_8e23febd912113c830b6@a434gfdinter9.mail>
May 24 17:58:14 mail postfix/qmgr[30879]: 7FD4D41A08: from=<user@external_domain.com>, size=2231, nrcpt=1 (queue active)
May 24 17:58:14 mail postfix/local[32302]: 7A43B41A02: to=<root@my_domain.com>, relay=local, delay=0.03, delays=0.02/0.01/0/0, dsn=2.0.0, status=sent (forwarded as 7FD4D41A08)
May 24 17:58:14 mail postfix/qmgr[30879]: 7A43B41A02: removed
May 24 17:58:14 mail postfix/smtp[32303]: 7FD4D41A08: to=<end_destination@gmail.com>, orig_to=<root@my_domain.com>, relay=relay.my_vps_host.com[177.153.9.96]:25, delay=0.33, delays=0/0.01/0.31/0.01, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as CE14D777DC134)
May 24 17:58:14 mail postfix/qmgr[30879]: 7FD4D41A08: removed

When sending a local email to root (for example: crontab jobs), the email arrives successfully at the local account and also at "end_destination@gmail.com", see the log:

May 24 17:55:03 mail postfix/smtp[32250]: 6E08B41A02: to=<end_destination@gmail.com>, orig_to=<root>, relay=relay.my_vps_host.com[177.153.9.96]:25, delay=1.2, delays=0.01/0.02/0.93/0.28, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 6732B777D6711)
May 24 17:55:03 mail postfix/qmgr[30879]: 6E08B41A02: removed

I am strongly suspected of having a filter at "relay.my_vps_host.com" blocking the messages.

So I opened a check request with the support of my server and they informed me that there is no any kind of lock in the relay ("relay.my_vps_host.com").

The emails that should be forwarded simply do not reach at "end_destination@gmail.com".

/etc/postfix/main.cf:

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no
append_dot_mydomain = no
readme_directory = no
compatibility_level = 2
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated 
defer_unauth_destination
myhostname = mail.my_domain.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $myhostname, my_domain.com,  mail.my_domain.com, localhost.my_domain.com, , localhost
relayhost = relay.my_vps_host.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all

/etc/postfix/master.cf:

# Postfix master process configuration file.  For details on the format
# of the file, see the master(5) manual page (command: "man 5 master" or
# on-line: http://www.postfix.org/master.5.html).
#
# Do not forget to execute "postfix reload" after editing this file.
#
# ==========================================================================
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (no)    (never) (100)
# ==========================================================================
smtp      inet  n       -       y       -       -       smtpd
#smtp      inet  n       -       y       -       1       postscreen
#smtpd     pass  -       -       y       -       -       smtpd
#dnsblog   unix  -       -       y       -       0       dnsblog
#tlsproxy  unix  -       -       y       -       0       tlsproxy
submission inet n       -       y       -       -       smtpd
#  -o syslog_name=postfix/submission
#  -o smtpd_tls_security_level=encrypt
#  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_reject_unlisted_recipient=no
#  -o smtpd_client_restrictions=$mua_client_restrictions
#  -o smtpd_helo_restrictions=$mua_helo_restrictions
#  -o smtpd_sender_restrictions=$mua_sender_restrictions
#  -o smtpd_recipient_restrictions=
#  -o smtpd_relay_restrictions=permit_sasl_authenticated,reject
#  -o milter_macro_daemon_name=ORIGINATING
#smtps     inet  n       -       y       -       -       smtpd
#  -o syslog_name=postfix/smtps
#  -o smtpd_tls_wrappermode=yes
#  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_reject_unlisted_recipient=no
#  -o smtpd_client_restrictions=$mua_client_restrictions
#  -o smtpd_helo_restrictions=$mua_helo_restrictions
#  -o smtpd_sender_restrictions=$mua_sender_restrictions
#  -o smtpd_recipient_restrictions=
#  -o smtpd_relay_restrictions=permit_sasl_authenticated,reject
#  -o milter_macro_daemon_name=ORIGINATING
#628       inet  n       -       y       -       -       qmqpd
pickup    unix  n       -       y       60      1       pickup
cleanup   unix  n       -       y       -       0       cleanup
qmgr      unix  n       -       n       300     1       qmgr
#qmgr     unix  n       -       n       300     1       oqmgr
tlsmgr    unix  -       -       y       1000?   1       tlsmgr
rewrite   unix  -       -       y       -       -       trivial-rewrite
bounce    unix  -       -       y       -       0       bounce
defer     unix  -       -       y       -       0       bounce
trace     unix  -       -       y       -       0       bounce
verify    unix  -       -       y       -       1       verify
flush     unix  n       -       y       1000?   0       flush
proxymap  unix  -       -       n       -       -       proxymap
proxywrite unix -       -       n       -       1       proxymap
smtp      unix  -       -       y       -       -       smtp
relay     unix  -       -       y       -       -       smtp
#       -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq     unix  n       -       y       -       -       showq
error     unix  -       -       y       -       -       error
retry     unix  -       -       y       -       -       error
discard   unix  -       -       y       -       -       discard
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       y       -       -       lmtp
anvil     unix  -       -       y       -       1       anvil
scache    unix  -       -       y       -       1       scache
#
# ====================================================================
# Interfaces to non-Postfix software. Be sure to examine the manual
# pages of the non-Postfix software to find out what options it wants.
#
# Many of the following services use the Postfix pipe(8) delivery
# agent.  See the pipe(8) man page for information about ${recipient}
# and other message envelope options.
# ====================================================================
#
# maildrop. See the Postfix MAILDROP_README file for details.
# Also specify in main.cf: maildrop_destination_recipient_limit=1
#
maildrop  unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
#
# ====================================================================
#
# Recent Cyrus versions can use the existing "lmtp" master.cf entry.
#
# Specify in cyrus.conf:
#   lmtp    cmd="lmtpd -a" listen="localhost:lmtp" proto=tcp4
#
# Specify in main.cf one or more of the following:
#  mailbox_transport = lmtp:inet:localhost
#  virtual_transport = lmtp:inet:localhost
#
# ====================================================================
#
# Cyrus 2.1.5 (Amos Gouaux)
# Also specify in main.cf: cyrus_destination_recipient_limit=1
#
#cyrus     unix  -       n       n       -       -       pipe
#  user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user}
#
# ====================================================================
# Old example of delivery via Cyrus.
#
#old-cyrus unix  -       n       n       -       -       pipe
#  flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user}
#
# ====================================================================
#
# See the Postfix UUCP_README file for configuration details.
#
uucp      unix  -       n       n       -       -       pipe
  flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
#
# Other external delivery methods.
#
ifmail    unix  -       n       n       -       -       pipe
  flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp     unix  -       n       n       -       -       pipe
  flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender     $recipient
scalemail-backend unix  -       n       n       -       2       pipe
  flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
mailman   unix  -       n       n       -       -       pipe
  flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
  ${nexthop} ${user}

The SPF for my_domain.com:

  • v=spf1 +a +mx +ptr:my_vps_host.com include:_spf.google.com -all

Can someone help get the forwarded email to arrive at "root@my_domain.com"?

Thank you so much!

  • Does any of the related domains has an SPF record in DNS? Your supplied logs indicate that the problem is not your forwarding configuration but somewhere either at the relay or at gmail. Do you have access to email log files on the relay? If not you know from your logs the mail id on the relay, you can maybe ask suport for the logs for this particular id. – Lienhart Woitok May 25 '18 at 22:27
  • SPF at my_domain.com: v=spf1 +a +mx +ptr:my_vps_host.com include:_spf.google.com -all . I have not access to the relay logs. – Allan Andrade May 25 '18 at 22:34
  • So there is no SPF record for external_domain.com? My next step would be to ask support for mail logs from the relay for mail with id CE14D777DC134 (that is the id from your log under which the relay accepted the forwarded mail) and go from there. Without those, one can only guess. – Lienhart Woitok May 25 '18 at 23:24
  • external_domain.com represents any external domain like [@]aol.com, [@]gmail.com, etc. So, no SPF for external_domain.com. I'll ask support for logs from relay. Thanks for your time! – Allan Andrade May 25 '18 at 23:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.