I'm trying to get a working Postfix and currently I'm dealing with the following error in my logs:
postfix/qmgr[57927]: 0E37E7B9B9: from=<[email protected]>, size=250, nrcpt=1 (queue active)
postfix/virtual[71608]: 0E37E7B9B9: to=<userexample.com>, relay=virtual, delay=4898, delays=4898/0.01/0/0.03, dsn=2.0.0, status=sent (delivered to mailbox)
postfix/cleanup[71617]: 7E2FB7BAB3: message-id=<[email protected]>
postfix/bounce[71610]: 0E37E7B9B9: sender delivery status notification: 7E2FB7BAB3
postfix/qmgr[57927]: 7E2FB7BAB3: from=<>, size=2338, nrcpt=1 (queue active)
postfix/qmgr[57927]: 0E37E7B9B9: removed
postfix/smtp[71623]: 7E2FB7BAB3: to=<[email protected]>, relay=<AWS SES SMTP Endpoint>, delay=0.3, delays=0.02/0.01/0.27/0.01, dsn=5.0.0, status=bounced (host <AWS SES SMTP Endpoint> said: 501 Invalid MAIL FROM address provided (in reply to MAIL FROM command))
This log was generated by me using Telnet to send an email to myself. The email arrives correctly but its possible to see that the success notification could not be sent because my relay rejected the FROM domain.
This happens because Postfix seems to be generating this email as the sender [email protected]
but my relay only accepts emails in the form of @example.com
. Or maybe I read the logs wrong, and something else (maybe an empty FROM?)
Is there a way to set that in Postfix? I did some reserach and could not came with a working solution.
Postfix configuration:
command_directory = /usr/local/sbin
compatibility_level = 3.8
daemon_directory = /usr/local/libexec/postfix
data_directory = /var/db/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
html_directory = /usr/local/share/doc/postfix
inet_protocols = all
mail_owner = postfix
mailq_path = /usr/local/bin/mailq
manpage_directory = /usr/local/man
meta_directory = /usr/local/libexec/postfix
mydomain = example.com
myhostname = mail.example.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mynetworks_style = host
myorigin = example.com
newaliases_path = /usr/local/bin/newaliases
queue_directory = /var/spool/postfix
readme_directory = /usr/local/share/doc/postfix
relayhost = <AWS SES SMTP endpoint>:587
sample_directory = /usr/local/etc/postfix
sendmail_path = /usr/local/sbin/sendmail
setgid_group = maildrop
shlib_directory = /usr/local/lib/postfix
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/usr/local/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_CApath = /etc/ssl/certs
smtp_tls_security_level = encrypt
smtp_use_tls = yes
smtpd_relay_restrictions = permit_mynetworks, reject_unauth_destination
tls_random_source = dev:/dev/urandom
unknown_local_recipient_reject_code = 550
virtual_alias_maps = pgsql:/usr/local/etc/postfix/sql/virtual_alias_maps.cf
virtual_gid_maps = static:125
virtual_mailbox_base = /mnt/emails/postfix
virtual_mailbox_domains = pgsql:/usr/local/etc/postfix/sql/virtual_mailbox_domains.cf
virtual_mailbox_maps = pgsql:/usr/local/etc/postfix/sql/virtual_mailbox_maps.cf
virtual_uid_maps = static:125