0

I have setup a mail server using this guide: https://www.ostechnix.com/setup-mail-server-using-postfixdovecotsquirrelmail-in-centosrhelscientific-linux-6-3-step-by-step/

The webmail allows to send emails between own users i.e. in local machine and to the other servers like gmail. But it cannot receive emails from outside world. Here is what I have in /etc/postfix/main.cf:

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
command_directory = /usr/sbin
compatibility_level = 2
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/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
home_mailbox = Maildir/
html_directory = no
inet_interfaces = localhost
inet_protocols = all
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
meta_directory = /etc/postfix
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
mydomain = domain.com
myhostname = mail.domain.com
mynetworks = 192.168.0.0/24, 127.0.0.0/8, [::1]/128
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix/README_FILES
sample_directory = /usr/share/doc/postfix/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
shlib_directory = /usr/lib64/postfix
unknown_local_recipient_reject_code = 550

Mydomain and myhostname is fake though. Also our ISP shouldn't block any inbound SMTP connections on port 25, but we have to double check that in a meantime. Please, advise!

Update 14/11/2017: Enabled firewalld service once again and opened the mentioned ports. Now this error appears when trying to send an email on squirrelmail: Connection refused 111 Can't open SMTP stream. Please help

Yerbol
  • 43
  • 2
  • 7
  • *"Mydomain and myhostname is fake though"* - How should the sending mailserver than be able to reach your mailserver? You need to use a public routeable domain and have according MX-Records defined for that domain that point to your mailserver. – noraab Nov 13 '17 at 14:52
  • @Yerbol means that the variables mydomain and myhostname are fake only within the config file posted here – lg. Nov 13 '17 at 15:02

1 Answers1

1

The directive:

inet_interfaces = localhost

restricts Postfix to receiving mails on localhost. Try setting that to

inet_interfaces = all

to actually accept incoming connections from the internet as well.

(And rather than completely disabling the firewall as in that recipe, open TCP port 25 (SMTP), 143 (IMAP) and 80/443 (HTTP/HTTPS) in your firewall and keep it enabled.)

HBruijn
  • 72,524
  • 21
  • 127
  • 192
  • also had to add my ip to dns server as smtp.domain.com to actually find it from outside world, add smtp.domain.com to /etc/hosts file. i will enable the firewall as you suggested – Yerbol Nov 14 '17 at 05:22
  • Enabled firewalld service once again and opened the mentioned ports. Now this error appears when trying to send an email on squirrelmail: Connection refused 111 Can't open SMTP stream. Please help – Yerbol Nov 14 '17 at 11:04
  • https://serverfault.com/questions/725262/what-causes-the-connection-refused-message – HBruijn Nov 14 '17 at 11:09