Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 05-13-2013, 02:31 PM   #1
Registered: Feb 2010
Posts: 33

Rep: Reputation: 0
Configuring postfix to send system mail to an external address (DynDNS)

I use a DynDNS host to connect to various services running on my home server.

I currently have Postfix configured to only send mail locally and all system/root mail is sent to my user account via an alias.

I'd like to reconfigure Postfix so the server can also send email externally so I can send system mail to my email account.

There are lots of tutorials out there that explain how to install a complete mail server for a domain but I'm having some difficulty understanding how to do this basic task with a DynDNS host.

Can someone please point me in the right direction?

Last edited by pwatk; 05-22-2013 at 02:27 PM.
Old 05-13-2013, 03:21 PM   #2
Registered: May 2013
Posts: 75

Rep: Reputation: Disabled

The first thing you need is a domain of your own, then you can configure your DyNDNS account for that domain. After that you can follow any guide specific for your Linux version and voilá.

Good Luck

Sire Maxus
Old 05-14-2013, 06:11 AM   #3
Registered: Feb 2010
Posts: 33

Original Poster
Rep: Reputation: 0
Thanks for your reply but I don't really need my own domain (at the moment anyway) so I was trying to avoid this.
Old 05-17-2013, 04:01 PM   #4
Registered: Feb 2010
Posts: 33

Original Poster
Rep: Reputation: 0
I'm starting to think that I need to relay the mail through another server but everywhere I look gives a different solution.

I have two questions (for starters):

1) I don't understand what the difference is between a smarthost and a satellite.

2) If I was to use a Gmail account as a relay would it appear as though I was emailing myself.

Last edited by pwatk; 05-22-2013 at 02:28 PM.
Old 05-22-2013, 02:26 PM   #5
Registered: Feb 2010
Posts: 33

Original Poster
Rep: Reputation: 0
I finally managed to figure this out using various guides I found.

Here's my notes.

First, I created a new Gmail account with an appropriate name to use as my SMTP relay.

I already had Postfix installed on a Ubuntu Server but configured to deliver local mail only so I started by reconfiguring it for 'Internet with smarthost'.

dpkg-reconfigure postfix
Once complete I had to add a few extra settings to /etc/postfix/ to enable TLS and SASL authentication.

postconf -e 'relayhost ='
postconf -e 'smtp_use_tls = yes'
postconf -e 'smtp_sasl_auth_enable = yes'
postconf -e 'smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd'
postconf -e 'smtp_sasl_security_options = no'
postconf -e 'smtp_sasl_security_options = noanonymous'
postconf -e 'smtp_sasl_tls_security_options = noanonymous'
postconf -e 'smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt'
I then created a hashed password file with my Gmail accounts login details. You can use an application specific password here if you have two factor authentication enabled on the account.

echo ' <user><password>' > /etc/postfix/sasl_passwd
postmap hash:/etc/postfix/sasl_passwd
rm /etc/postfix/sasl_passwd
chmod 600 /etc/postfix/sasl_passwd.db
From here there are various options for forwarding mail to your desired email address. I already had all root mail sent to my user account via /etc/aliases. I could have altered this but I simply created a .forward file in my home directory and that's how it's stayed.

That's it, I now have all system mail sent to my personal email account and I can enable mail functions in the web applications on the server.

Some useful links:
Day in my life: Postfix smarthost with SMTP authentication
Setup postfix using an authorized relay host (Gmail) for RHEL/CentOS | stigmatedbrain's corner » Blog Archive » Using gmail as a Postfix Smarthost
Configure Postfix to Use Gmail SMTP on Ubuntu
Old 10-07-2014, 04:04 PM   #6
Registered: Feb 2010
Posts: 33

Original Poster
Rep: Reputation: 0
I recently ran into some difficulty with the above setup after changing DNS settings on my server.

To cut a long story short I should have encased the relayhost ( in square brackets to stop postfix doing an MX lookup and failing to find the server.

The following commands fix this problem:

postconf -e 'relayhost = []:587'
echo '[]:587 <user><password>' > /etc/postfix/sasl_passwd
Another useful link:
Configuring postfix to relay mail to a secure host


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Setup Postfix to Send Local Mail to Internet Email Address sumit1203 Linux - Newbie 1 09-02-2012 01:55 AM
Postfix mail server with DynDNS tutorials Vimuth Linux - Server 7 06-30-2011 06:19 AM
Cant send external mail with postfix Alt-Ox Linux - Newbie 1 08-25-2009 01:09 AM
Postfix - how to set the IP address used to send mail on a multi-IP server. h00chman Linux - Server 5 04-20-2009 04:33 PM
send mail to external email address hamish Linux - Networking 8 12-10-2004 09:17 AM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 11:32 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration