3

On my home Ubuntu box, postfix is configured to relay all outgoing email to outgoing.verizon.net. Unfortunately this includes local user-to-user email (e.g., from local cron jobs to me, or from me to myself) which should not need to travel off-machine. Is there a way to tweak my configuration (below) so local email is delivered without leaving my machine?

Note: I don't run a mail server (on port 25) but rather run fetchmail every five minutes to download from an IMAP server.

main.cf:

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = mycomputer.example.com
masquerade_domains = example.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $myhostname, localhost.localdomain, localhost
relayhost = [outgoing.verizon.net]:587
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
smtp_sasl_auth_enable = yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options =
smtpd_sasl_auth_enable = no
DanB
  • 135

1 Answers1

2

Postfix will only relay non-local mails to the host specified in the relayhost. To consider a domain local; the domain has to be listed under mydestination parameter. So listing example.com under mydestination should help you to fix this issue.

#/etc/postfix/main.cf
#...
mydestination = $myhostname, localhost.localdomain, localhost, example.com
#...

Ref: Postfix docs

relayhost (default: empty)

The next-hop destination of non-local mail; overrides non-local domains in 
recipient addresses. This information is overruled with relay_transport, 
sender_dependent_default_transport_maps, default_transport, 
sender_dependent_relayhost_maps and with the transport(5) table. 
clement
  • 741