Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

linux postfix config and hostname FQDN

I'm trying to setup a mail server with postfix and dovecot using the tutorial from https://library.linode.com/email/postfix/postfix2.9.6-dovecot2.0.19-mysql#sph_prerequisites

I followed every steps and also opened every mail port in the firewall but when i try to setup my email client to connect with IMAP or POP3 it just can't establish the connection.

It appears i can send email to my domain using my private emailbox. Anyway my log /var/log/mail.log is empty.

I guess it has something to do with setting up a hostname (FQDN) and the postfix config. But I'm a bit confused about hostname and FQDN.. In my DNS Manager of linode I've added my domain which in this example is : mydomain.com

Inside mydomain.com i have this:

MX record 
mail.mydomain.com

A/AAAA Records
           120.120.120.120
www        120.120.120.120
mail       120.120.120.120
donald     120.120.120.120

donald is the FQDN as i followed through the tutorial

Now in my linux server i have a few things :

/etc/hosts
127.0.0.1       localhost
127.0.1.1       ubuntu
120.120.120.120 donald.mydomain.com        donald

and

/etc/mailname
donald.mydomain.com

the postfix config

/etc/postfix/main.cf
....
myhostname = mail.mydomain.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
....

As you see i think it's in this config that something is wrong. I don't understand what is myhostname and mydestination and the mailname... Could someone correct me with theses config ?

Thanks!

Edit I found out that i had an error in the dovecot main config and also that smtp port where already in use.. Well i restarted my server and both of postfix and dovecot are running. I could bind the imap server into my outlook client and receiving mail. Now when i try to reply the email i get this message: 554 5.7.1 : Relay access denied

Also here is my postfix config :

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
inet_interfaces = all
mailbox_size_limit = 0
mydestination = localhost
myhostname = mail.mydomain.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
readme_directory = no
recipient_delimiter = +
relayhost =
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = private/auth
smtpd_sasl_type = dovecot
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/ssl/certs/dovecot.pem
smtpd_tls_key_file = /etc/ssl/private/dovecot.pem
smtpd_use_tls = yes
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
virtual_transport = lmtp:unix:private/dovecot-lmtp
like image 395
yves Avatar asked Mar 22 '23 17:03

yves


1 Answers

Please refer postfix configuration parameters for more help.

myorigin = mydomain.com 
# The domain name to append when the UNIX user sends out a mail. (For eg. If UNIX user john sends mail, then [email protected] will be the sender address
myhostname = mail.mydomain.com
# The unique FQDN of your mail server. When talking to other SMTP servers, it identifies itself as mail.mydomain.com
mydestination = mydomain.com mail.mydomain.com
# You are instructing postfix to receive mails for the domains mydomain.com mail.mydomain.com, whose valid recipients can be specified using local_recipient_maps

Can you edit your question and paste the output of postconf -n, that will help to identify the issues

like image 150
clement Avatar answered Apr 05 '23 07:04

clement