I have a windows server, acting as a web server and mail server.
For the mailserver I use hmailserver and works fine recieving emails but not so good sending emails because I cannot setup reverse DNS on that machine.So, I purchased an Ubuntu linux VPS, configured reverse DNS and installed postfix.
Now, in the nwindows machine, in hMailserver there is an option to specify the Host name and port of the SMTP relayer (the linux box). I did this, but now what else should I configure in postfix to allow sending email to/from any recipient?
EDIT 1: I can telnet the SMTP server but I can not go after the rcpt to command. Here is the output:
220 mailgate.mydomain.com ESMTP Postfix (Ubuntu) ehlo mailgate.mydomain.com 250-mailgate.mydomain.com 250-PIPELINING 250-SIZE 10240000 250-VRFY 250-ETRN 250-STARTTLS 250-ENHANCEDSTATUSCODES 250-8BITMIME 250 DSN mail from:<yiannis@domain.com> 250 2.1.0 Ok rcpt to:<guser@gmail.com> 451 4.3.0 <guser@gmail.com>: Temporary lookup failure
And in mail.log I see:
Jul 30 17:23:20 mailgate postfix/smtpd[1824]: warning: non-existent:/32 is unavailable. openfile /32: no such file or directory Jul 30 17:23:20 mailgate postfix/smtpd[1824]: warning: table lookup problem
Answer
I finally managed to make it work. I had to make some changes to the postfix configuration file located at /etc/postfix/main.cf
Here is the complete working configuration file and install steps that allows hMailServer use postfix at another machine as an SMTP relayer:
I used the minimal version of Ubuntu server 14.04. It runs fine on 2GB hard disk, 64MB RAM OpenVZ.
apt-get update
iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 25 -j ACCEPT
iptables -A INPUT -m state --state NEW -m udp -p udp --dport 25 -j ACCEPT
apt-get install postfix
--> mail configuration: 2 (Internet Site )
--> System mail name: do not enter anything
vi /etc/postfix/main.cf
Change main.cf like this (relace yourdomain with your domain name and yourServerIpAddress with your server ip address):
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
readme_directory = no
# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.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
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
myhostname = mailgate.yourdomain.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = $mydomain
mydestination = $myhostname, localhost, $mydomain
relayhost =
mynetworks = 127.0.0.0/8, yourServerIpAddress(also setup reverse DNS for it pointing to mailgate.yourdomain.com)
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
mydomain = yourdomain.com
relay_domains = $mydestination
home_mailbox = Maildir/
local_recipient_maps =
message_size_limit = 20480000
Finally restart postfix
service postfix restart
Now, test your mailserver from: http://mxtoolbox.com/diagnostic.aspx
(everything should be green)
For troubleshooting you can examine postfix log file
cat /var/log/mail.log
Good luck!
Attribution
Source : Link , Question Author : Yiannis Mpourkelis , Answer Author : Yiannis Mpourkelis