Posted by: jasonk2600 | November 7, 2009

Quickie HowTo – SMTP Proxy on FreeBSD


Install the Postfix SMTP server from the FreeBSD ports collection. Be sure to enable Postfix as the default mailer when prompted towards the end of the installation.

# cd /usr/ports/mail/postfix
# make install clean
# rehash


Modify /usr/local/etc/postfix/ to use the following settings. Change proxy-smtp to the hostname of your Postfix SMTP proxy system, change to the domain name that your SMTP proxy is on, change to the domain of your email, and change to the fully qualified domain name of your real mail server (the final destination of the email).

myhostname =
mydomain =
mydestination = $myhostname, localhost.$mydomain, localhost
relay_domains =
relayhost = []

Enable Postfix to start at system boot and disable all Sendmail functions. Modify /etc/rc.conf to use the following settings:



Before starting Postfix for the first time, make sure that the system’s mail aliases have been updated to the Postfix format by executing the following command:

# newaliases

To begin testing the newly configured Postfix SMTP Proxy, start Postfix.

# /usr/local/etc/rc.d/postfix start

Monitor Postfix’s actions through /var/log/maillog.

# tail -f /var/log/maillog

Telnet to the Postfix SMTP server and manually send an email to a real user. Watch the output of maillog to verify that Postfix relays the message onto the real SMTP server that was specified. NOTE: Text in bold is input.

# telnet localhost 25
Connected to localhost.
Escape character is '^]'.
220 ESMTP Postfix
250-SIZE 10240000
250 DSN
mail from:
250 2.1.0 Ok
rcpt to:
250 2.1.5 Ok
354 End data with .
This is a test message!
250 2.0.0 Ok: queued as 5D31B11432
221 2.0.0 Bye
Connection closed by foreign host.

Maillog should show something similar to the following. NOTE: You can see that Postfix queued the message to be relayed onto

Nov  6 16:50:06 horus postfix/postfix-script[30772]: starting the Postfix mail system
Nov  6 16:50:06 proxy-smtp postfix/master[30773]: daemon started -- version 2.6.5, configuration /usr/local/etc/postfix
Nov  6 17:00:32 proxy-smtp postfix/smtpd[30808]: connect from localhost[]
Nov  6 17:00:51 proxy-smtp postfix/smtpd[30808]: 5D31B11432: client=localhost[]
Nov  6 17:00:57 proxy-smtp postfix/cleanup[30811]: 5D31B11432: message-id=<>
Nov  6 17:00:57 proxy-smtp postfix/qmgr[30775]: 5D31B11432: from=, size=371, nrcpt=1 (queue active)
Nov  6 17:00:57 proxy-smtp postfix/smtp[30812]: 5D31B11432: to=, relay=[]:25, delay=14, delays=13/0.01/0.07/0.43, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as A837417097)
Nov  6 17:00:57 proxy-smtp postfix/qmgr[30775]: 5D31B11432: removed
Nov  6 17:00:58 proxy-smtp postfix/smtpd[30808]: disconnect from localhost[]


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: