Postfix configuration help needed.

yugpatel

Senior member
Feb 28, 2001
506
0
76
I have followed the article ([http]https://www.digitalocean.com/community/articles/how-to-set-up-a-postfix-e-mail-server-with-dovecot[/http]) to set up e-mail server. The problem I face is, emails are being sent as foo@mail.example.com instead of foo@example.com. What am I doing wrong

Here is my main.cf:
**********************************
myorigin = /etc/mailname
myhostname = mail.example.com
mydestination = localhost, mail.example.com, localhost.example.com
smtpd_banner = $myhostname ESMTP
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all

alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases

smtpd_tls_cert_file=/etc/ssl/private/cert.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-key.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
smtpd_tls_security_level=may
smtpd_tls_protocols = !SSLv2, !SSLv3
smtpd_helo_required = yes
local_recipient_maps = proxy:unix:passwd.byname $alias_maps

smtpd_helo_restrictions = permit_mynetworks,
reject_non_fqdn_helo_hostname, reject_invalid_helo_hostname,
reject_unknown_helo_hostname, permit
smtpd_recipient_restrictions = reject_unknown_client_hostname,
reject_unknown_sender_domain, reject_unknown_recipient_domain,
reject_unauth_pipelining, permit_mynetworks,
permit_sasl_authenticated, reject_unauth_destination,
reject_invalid_hostname, reject_non_fqdn_sender
smtpd_sender_restrictions = reject_unknown_sender_domain,
reject_sender_login_mismatch
**************************************************
/etc/mailname is:
example.com
 

smakme7757

Golden Member
Nov 20, 2010
1,487
1
81
What are you using to send an email?

I know roundcude appends the entire hostname to emails which can be changed in the configuration.
 

yugpatel

Senior member
Feb 28, 2001
506
0
76
What are you using to send an email?

I know roundcude appends the entire hostname to emails which can be changed in the configuration.

I am using commandline mailutils to send and receive e-mail. I will try using Thunderbird.
 

yugpatel

Senior member
Feb 28, 2001
506
0
76
Interestingly enough i had this problem today :).

Edit
/etc/mailname
from host.domain.com to just domain.com

As I mentioned in my original post, I changed the mailname to mydomain.com from
server.mydomain.com and I still have the problem.
 

KillerBee

Golden Member
Jul 2, 2010
1,750
82
91
Try commenting out the "myorigin = /etc/mailname" so it doesn't use it

and change the line "myhostname = mail.example.com"
to "myhostname = example.com"

restart postfix

run "postconf -n" to show just the changes from the default values
 

yugpatel

Senior member
Feb 28, 2001
506
0
76
Try commenting out the "myorigin = /etc/mailname" so it doesn't use it

and change the line "myhostname = mail.example.com"
to "myhostname = example.com"

restart postfix

run "postconf -n" to show just the changes from the default values

I will give it a shot and post the result. In order to make sure my MX record,A record and DNS record is correct, I installed hMainserver under Win server 2008 and it worked flawlessly. It send out mail as foo@example.com.
 
Last edited: