I've done quite a bit of googling on how to reconfigure postfix to work on a different port, but I still can't fond the line(s) people keep talking about in my master.cf. I'm using OS X Mountain Lion, and my ISP blocks traffic both ways on port 25.

people have said to look for a line that says

smtp  inet  n  -  n  -  -  smtpd

I can't find it.

This is (what I believe to be) unmodified

# ==== Begin auto-generated section ========================================
# This section of the master.cf file is auto-generated by the Server Admin
#  Mail backend plugin whenever mails settings are modified.
smtp      inet  n       -       n       -       1       postscreen
smtpd     pass  -       -       n       -       -       smtpd
dnsblog   unix  -       -       n       -       0       dnsblog
tlsproxy  unix  -       -       n       -       0       tlsproxy
submission inet  n       -       n       -       -       smtpd
  -o smtpd_tls_security_level=encrypt
smtp      unix  -       -       n       -       -       smtp
# === End auto-generated section ===========================================
# Modern SMTP clients communicate securely over port 25 using the STARTTLS command.
# Some older clients, such as Outlook 2000 and its predecessors, do not properly
# support this command and instead assume a preconfigured secure connection
# on port 465. This was sometimes called "smtps", but such usage was never
# approved by the IANA and therefore conflicts with another, legitimate assignment.
# For more details about managing secure SMTP connections with postfix, please see:
#   http://www.postfix.org/TLS_README.html
# To read more about configuring secure connections with Outlook 2000, please read:
#   http://support.microsoft.com/default.aspx?scid=kb;en-us;Q307772
# Apple does not support the use of port 465 for this purpose.
# After determining that connecting clients do require this behavior, you may choose
# to manually enable support for these older clients by uncommenting the following
# four lines.
#465        inet  n       -       n       -       -       smtpd
#  -o smtpd_tls_wrappermode=yes
#  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
#  -o milter_macro_daemon_name=ORIGINATING
#628       inet  n       -       n       -       -       smtp
pickup    fifo  n       -       n       60      1       pickup
cleanup   unix  n       -       n       -       0       cleanup
qmgr      fifo  n       -       n       300     1       qmgr
#qmgr     fifo  n       -       n       300     1       oqmgr
tlsmgr    unix  -       -       n       1000?   1       tlsmgr
rewrite   unix  -       -       n       -       -       trivial-rewrite
bounce    unix  -       -       n       -       0       bounce
defer     unix  -       -       n       -       0       bounce
trace     unix  -       -       n       -       0       bounce
verify    unix  -       -       n       -       1       verify
sacl-cache unix -       -       n       -       1       sacl-cache
flush     unix  n       -       n       1000?   0       flush
proxymap  unix  -       -       n       -       -       proxymap
proxywrite unix -       -       n       -       1       proxymap
# When relaying mail as backup MX, disable fallback_relay to avoid MX loops
relay     unix  -       -       n       -       -       smtp
        -o smtp_fallback_relay=
#       -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq     unix  n       -       n       -       -       showq
error     unix  -       -       n       -       -       error
retry     unix  -       -       n       -       -       error
discard   unix  -       -       n       -       -       discard
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       n       -       -       lmtp
anvil     unix  -       -       n       -       1       anvil
scache    unix  -       -       n       -       1       scache
# ====================================================================
# Interfaces to non-Postfix software. Be sure to examine the manual
# pages of the non-Postfix software to find out what options it wants.


Just to clarify, I don't need to recieve mail, I just need to send it, so as long as I send mail to every email client (yahoo, gmail, hotmail, aol, cox, etc.). The idea of the post is to be able to send mail from Ruby or PHP, if your port 25 is blocked.


What are you trying to accomplish?

Inbound mail: Other SMTP servers (on the outside) require port 25 to send mails to you. Even if you change your port to - let's say 25250 - the others don't know that they need to access this port to send mails to you.

Outbound mail: Your server does not use port 25 as source port for sending mails. It uses port 25 as destination port on the (outside) servers. Whatever port you are trying to configure locally, you can't influence the outside world.

Relaying mail through (external) smart host: Just do it if the server smart host accepts mail on different ports. http://www.postfix.org/postconf.5.html#relayhost

  • I just need to send outgoing mail. I'm using ruby/sinatra with the pony gem, which uses postfix Sep 22 '12 at 16:04
  • @bwheeler96 Then go ahead and use an external relay host.
    – mailq
    Sep 25 '12 at 21:11

So as it turns out, cox only blocks traffic on port 25 that isn't to or from a cox server, so the easiest way to get around this, is by going in to main.cf and setting up a relayhost. Fortunately cox allows you to use their server at smtp.cox.net, which listens on port 25.

relayhost = [smtp.cox.net]:25


You are using port 587 (submission) wich is the right one now instead of 25. You need to configure your clients to use port 587 if they don't do that automatically already.

The line you need to see is:

submission inet  n       -       n       -       -       smtpd

and your config looks ok on this point.

  • Note that it's not one or the other. You want to keep Postfix listening on port 25 so that other MTAs can send mail to you. You enable submission in addition to that so that authenticated users can send mail elsewhere (i.e. relay through your server). Sep 19 '12 at 9:19
  • True, but with his ISP is blocking port 25 both sides, there is no utility listening on port 25.
    – laurent
    Sep 19 '12 at 11:42
  • There is no utility on listening on any other port too : The only solution you have is to change ISP and choose a decent one (i'm ok with ISPs that block port 25 by default but let the ability to unblock it).
    – user130370
    Sep 19 '12 at 19:46

Just for the sake of completeness, you don't see a line

smtp  inet  n  -  n  -  -  smtpd

in your master.cf because you're running Postscreen in front of Postfix:

smtp  inet  n  -  n  -  1  postscreen
smtpd  pass -  -  n  -  -  smtpd
  • So what does that mean for me? Sep 22 '12 at 16:05
  • So is there a way for me to remove poestscreen, and then subsequently send mail on a different port? Sep 22 '12 at 16:36
  • Postscreen doesn't have anything to do with this, it's merely an early-on measure against botnet spam targeting your mail server. Like I said, this answer was only for completeness, to explain why you didn't see that particular smtpd line in your master.cf. Sep 23 '12 at 14:38

Not the answer you're looking for? Browse other questions tagged or ask your own question.