Comments on How To Relay Email On A Postfix Server

How To Relay Email On A Postfix Server For two small businesses I set up a debian lenny installation on their "home" dsl connection. The problem is that they have dynamic ip addresses and most mailservers will not accept incoming mail from a server on a dynamic ip address. The solution is rather simple. Set up postfix in a way that it will relay the outgoing email through the actual ISP. In this short howto I'll show you how to do that.

14 Comment(s)

Add comment

Please register in our forum first to comment.

Comments

By:

There are many options. You can setup multiple backup mail servers all on dhcp... IP won't change for them at the same time... or very unlikely Besides, if a server can't be reached now mailservers usually won't bounce the message but retry (up to 7 days IIRC) As for updating DNS, you can use everydns.net and have it updated like every 30min. I've run such a setup on several home servers without hearing complaints about email not having been received or delivered. Also the IP doesn't change all the time. On normal DSL here it's every 24h and on vdsl it's like every 30 days. But try this setup and check if mail doesn't get delivered...

By:

Benefits: - setup as you want to - unlimited emails/domains - "unlimited" diskspace - ... And if you care about security/privavcy anyway, then you'll encrypt everything. So relaying outgoing email through your ISP has no effect...

By: Anonymous

Sending email is only half the problem. What about receiving email when you have DHCP?

Check the dynamic IP every 5 min and automatically update your MX DNS record ... which can take 24 hrs to propagate.

OR

Pay an email forwarding service

OR

some other answer?

By: Anonymous

What is the point of a local email server if it can only receive mail directly? The only object I can see of a local server is better privacy and control. Sending mail via the ISP defeats this, so what is the point of a receive-only local server?

By: Russo

Send always to localhost:25, thus avoiding the DHCP problem.

By the way, I had to add a line:

smtp_use_tls = yes

in main.cf for this to work.

By:

If I am trying to send from a banned IP (in my case 24.92.180.59) is the inly solution either getting a static IP or finding offsite hosting?  I would really like to keep everything on the server in my house without spending anymore money.

By:

 This is my error after the how to:

server1 postfix/error[32447]: F2083A9FE9: to=, relay=none, delay=7.9, delays=0.26/7.4/0/0.27, dsn=4.7.0, status=deferred (delivery temporarily suspended: SASL authentication failed; cannot authenticate to server smtp.1and1.com[74.208.5.2]: no mechanism available)

By: Alberto Guerrero

Hello,

" SASL authentication failed" Did you try to authenticate against your server without relay config? Are username / password for smtp.1and1.com correct? gen-auth.pl is a great tool for checking that. (http://jetmore.org/john/code/gen-auth)

Greets

By: Stephen

my main.cf seems to have the form

smtpd_...

not

smtp_...

Are both viable or something?

By: Pedro

smtpd and smtp are diferente:

Compare them here.

By:

I have a STATIC IP, i can send and recieve mail from mi own server, i can recieve mail from external to my server (ex: gmail to my server) but when i send mail from my server to external server (like gmail, hotmail) my mail "sends" but the contact from gmail or hotmail NEVER recieve my mail!!!

What i have to do? 

 

By:

 I cant send mail from my server to gmail or other "external" server, my log says :

connect to alt4.gmail-smtp-in.l.google.com[74.125.79.26]:25: Connection timed out...

 WHY??

 Log file:

Sep 28 12:20:33 localhost postfix/smtp[4339]: F3C6913FD3: to=, relay=none, delay=105, delays=0.06/0/105/0, dsn=4.4.1, status=deferred (connect to alt4.gmail-smtp-in.l.google.com[74.125.79.26]:25: Connection timed out) Sep 28 12:20:37 localhost postfix/smtpd[4596]: connect from unknown[127.0.0.1] Sep 28 12:20:37 localhost postfix/smtpd[4596]: 152F614112: client=unknown[127.0.0.1] Sep 28 12:20:37 localhost postfix/cleanup[4592]: 152F614112: message-id= Sep 28 12:20:37 localhost postfix/smtpd[4596]: disconnect from unknown[127.0.0.1] Sep 28 12:20:37 localhost postfix/qmgr[3129]: 152F614112: from=, size=244630, nrcpt=1 (queue active) Sep 28 12:20:37 localhost amavis[3166]: (03166-04) Passed CLEAN, [209.85.218.54] [189.148.128.185] -> , Message-ID: , mail_id: W-1OE2p22ixA, Hits: 2.77, size: 243816, queued_as: 152F614112, 11264 ms Sep 28 12:20:37 localhost postfix/smtp[4593]: 29A1513FCC: to=, relay=127.0.0.1[127.0.0.1]:10024, delay=12, delays=0.87/0/0/11, dsn=2.0.0, status=sent (250 2.0.0 Ok, id=03166-04, from MTA([127.0.0.1]:10025): 250 2.0.0 Ok: queued as 152F614112) Sep 28 12:20:37 localhost postfix/qmgr[3129]: 29A1513FCC: removed Sep 28 12:20:37 localhost postfix/pipe[4721]: 152F614112: to=, relay=maildrop, delay=0.22, delays=0.12/0.01/0/0.1, dsn=2.0.0, status=sent (delivered via maildrop service) Sep 28 12:20:37 localhost postfix/qmgr[3129]: 152F614112: removed Sep 28 12:20:41 localhost postfix/smtp[4708]: connect to gmail-smtp-in.l.google.com[74.125.157.26]:25: Connection timed out Sep 28 12:20:41 localhost postfix/smtp[4709]: connect to mx3.hotmail.com[65.55.92.184]:25: Connection timed out Sep 28 12:20:56 localhost postfix/smtpd[4581]: disconnect from mail-yi0-f54.google.com[209.85.218.54] Sep 28 12:20:58 localhost imapd: Connection, ip=[::ffff:127.0.0.1] Sep 28 12:20:58 localhost imapd: LOGIN, [email protected], ip=[::ffff:127.0.0.1], port=[55061], protocol=IMAP Sep 28 12:20:58 localhost imapd: LOGOUT, [email protected], ip=[::ffff:127.0.0.1], headers=0, body=0, rcvd=52, sent=156, time=0

By: Anonymous

Hi I have the same problem.

How did u resolve it?

Thx

By: DJ Substance

This article is good. however its hard to find open relays anymore.. your best bet if your looking is script something to telnet to <25> of any server with mail running and do it the old way!