-4

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:<[email protected]>
250 2.1.0 Ok
rcpt to:<[email protected]>
451 4.3.0 <[email protected]>: 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
5
  • 1
    1. There's no reason you can't just use the Windows server. There's no need to add more parts than are necessary. 2. The rDNS record needs to be set up by the entity that manages the ip address space for the public ip address that the server will be sending email from, and as such, has nothing to do with the OS of the email server.
    – joeqwerty
    Jul 30, 2014 at 20:42
  • @joeqwerty 1. I cannot use the windows machine for sending emails because the provider canot configure rDNS for me. 2. I know that it has nothing to do with the OS. I purchased a cheap linux VPS to be able to configure rDNS and an SMTP server Jul 30, 2014 at 21:00
  • @yoonix I was able to install postfix, and using telnet test the SMTP but when I enter the rcpt to command I get the message: 451 4.3.0 <[email protected]>: Temporary lookup failure. See my updated question for the exact telnet output Jul 30, 2014 at 21:14
  • This defies logic. If you are going to use "the cloud" to send your e-mail, why not use a cloud e-mail service? Your general-purpose VPS surely has the potential to create long-term administration and security headaches.
    – Skyhawk
    Aug 2, 2014 at 17:34
  • @Skyhawk I do not want to use a cloud e-mail service because of privacy reasons and because I want to configure everything the way I want. It took me some time to configure it the first time but now I can setup postfix as an SMTP relayer in minutes. For this kind of thing there are no long-term administration an security headaches. Aug 5, 2014 at 16:04

1 Answer 1

0

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!

Not the answer you're looking for? Browse other questions tagged .