I have set up a postfix mail server behind a NAT. Am using a static 192.168 IP address, and have port 25 forwarded to that server. Also am using outgoing.verizon.net as a relay host, (And dovecot to provide IMAP service, but it's not running while I test this.) I am able to receive and send mail. The problem is, in sent mails, the sender has no host name. If I send a message from user1 to a Yahoo account, the mail is received, but the From field has "user1@.MISSING-HOST-NAME.". If I send a message to a local user (user2), the mail is received, but the From field has "user1@". I don't see what is wrong in the configuration.
I'm not even sure it's a problem with postfix, but what else could it be? I'm using Arch Linux, and they've recently switched to systemd. Could systemd be messing it up somehow? I've been testing with mutt and alpine, could either of those be causing this problem?
I edited /etc/hosts, so "hostname -f" reports "mail.example.com".
---------------
Here's my /etc/postfix/main.cf:
queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/lib/postfix
data_directory = /var/lib/postfix
mail_owner = postfix
myhostname = mail.example.com
myorigin = $mydomain
smtpd_tls_cert_file=/etc/ssl/certs/dovecot.pem
smtpd_tls_key_file=/etc/ssl/private/dovecot.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
relayhost = [outgoing.verizon.net]
smtp_connection_cache_destinations = outgoing.verizon.net
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = static:usern...@verizon.net:password
smtp_sasl_security_options = noanonymous
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
unknown_local_recipient_reject_code = 550
mynetworks = 192.168.0.0/16, 127.0.0.0/8
alias_maps = hash:/etc/postfix/aliases
alias_database = $alias_maps
home_mailbox = Maildir/
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
sendmail_path = /usr/sbin/sendmail
newaliases_path = /usr/bin/newaliases
mailq_path = /usr/bin/mailq
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/share/man
readme_directory = /usr/share/doc/postfix
inet_protocols = ipv4
----------------------------
Here's what I think is relevant output from postconf:
append_at_myorigin = yes
append_dot_mydomain = yes
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
mydomain = example.com
myhostname = mail.example.com
mynetworks = 192.168.0.0/16, 127.0.0.0/8
mynetworks_style = subnet
myorigin = $mydomain
----------------------------
And here's what I see in the logs when I send a message from user1 to user2:
Nov 02 08:30:59 mail systemd[1]: Starting Postfix Mail Transport Daemon...
Nov 02 08:31:00 mail postfix/postfix-script[3442]: starting the Postfix mail system
Nov 02 08:31:00 mail systemd[1]: Started Postfix Mail Transport Daemon.
Nov 02 08:31:00 mail postfix/master[3443]: daemon started -- version 2.9.4, configuration /etc/postfix
Nov 02 08:31:41 mail postfix/pickup[3444]: 80F0FA40: uid=1000 from=<user1>
Nov 02 08:31:41 mail postfix/cleanup[3451]: 80F0FA40: message-id=<20121102133141.GA3446@mail>
Nov 02 08:31:41 mail postfix/qmgr[3445]: 80F0FA40: from=<us...@example.com>, size=424, nrcpt=1 (queue active)
Nov 02 08:31:41 mail postfix/local[3453]: 80F0FA40: to=<us...@example.com>, orig_to=<user2>, relay=local, delay=0.14, delays=0.08/0.01/0/0.04, dsn=2.0.0, status=sent (delivered to maildir)
Nov 02 08:31:41 mail postfix/qmgr[3445]: 80F0FA40: removed
---------
I've tried several postfix configuration options, and had no luck:
masquerade_domains = $mydomain
disable_dns_lookups = yes
smtp_host_lookup = native
resolve_null_domain = yes
Anyone have any ideas what I'm missing?