LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 05-13-2013, 02:31 PM   #1
pwatk
Member
 
Registered: Feb 2010
Posts: 32

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
siremaxus
Member
 
Registered: May 2013
Posts: 75

Rep: Reputation: Disabled
Hi,

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
pwatk
Member
 
Registered: Feb 2010
Posts: 32

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
pwatk
Member
 
Registered: Feb 2010
Posts: 32

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
pwatk
Member
 
Registered: Feb 2010
Posts: 32

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'.

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

Code:
postconf -e 'relayhost = smtp.gmail.com:587'
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.

Code:
echo 'smtp.gmail.com:587 <user>@gmail.com:<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
braiden.org » Blog Archive » Using gmail as a Postfix Smarthost
Configure Postfix to Use Gmail SMTP on Ubuntu
 
  


Reply


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


All times are GMT -5. The time now is 02:21 PM.

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