3

I'm looking for the simpliest way to be able to send admin emails (backups, notifications) from an ubuntu server to my gmail address.

What is the best way to do that ? Should I just create a gmail account and use imap ? Or should I install postfix or something similar ? (I'm concerned about keeping it lightweight and avoid the need for too much configuration/security tweaks).

Thank you!

Thibaut Barrère
  • 691
  • 1
  • 9
  • 17
  • possible duplicate of [Setup ubuntu server to send mail()](http://serverfault.com/questions/119105/setup-ubuntu-server-to-send-mail) – GregD Nov 19 '10 at 12:11
  • 1
    possible duplicate of [Simple Mail System for Ubuntu?](http://serverfault.com/questions/73769/simple-mail-system-for-ubuntu) and [Receive email alerts from Linux file server](http://serverfault.com/questions/79899/receive-email-alerts-from-linux-file-server) – Dennis Williamson Nov 19 '10 at 15:11

4 Answers4

3

Just install Postfix. Default installation (internet site) will do.

In /etc/aliases add yourself as the alias to root

root: youraddresshere@gmail.com

You have to also run newaliases to update the indexed db file.

cstamas
  • 6,707
  • 25
  • 42
  • 1
    As long as there is no firewall blocking outgoing SMTP this will work just fine. Otherwise you might have to configure postfix to use a smarthost. +1 – pehrs Nov 19 '10 at 14:13
  • @pehrs: yeah that is true. +1 – cstamas Nov 19 '10 at 15:29
  • 1
    Postfix is usually overkill IMO, I use nullmailer to keep a minimal footprint. – NginUS Nov 21 '10 at 11:29
  • I wasn't aware of nullmailer and looked at it - apparently it works by connecting itself to remote smtp, right ? – Thibaut Barrère Nov 21 '10 at 13:11
  • We used to use nullmailer. But I replaced it with Postfix. It is much more easier. nullmailer queue management is just seems wrong. (It seems to me that if you reject a mail upstream it will stay in the queue forever, because nullmailer never discards a message.) – cstamas Nov 21 '10 at 14:19
1

If any of your servers are hosted a well known source for spam - which now include many cloud providers and hosters, any alias forwarding to gmail (or any such webmail provider) is likely to fail due to RBL policy.

What i usually do is setup a "google app for your domain" account, and add the necessary SPF record to the DNS zone so that google MXs will accept mail relayed through my hosts.

zuzur
  • 103
  • 1
  • 1
  • 5
  • Well thank you - I just figured this out during my tests (my emails gradually went to spam then ended being delivered!). I believe I'll use SendGrid or Google Apps. – Thibaut Barrère Nov 23 '10 at 19:59
0

If you have mail setup, you use mailx to send out email from a script...

my-backup-script.sh | mailx -s "results from backups" myemail@myhost.com

echo "just a test" | mailx -s "please ignore this" myemail@myhost.com

cat << EOF | mailx -s "more tests" myemail@myhost.com

this is a long

test of email in a

shell script

EOF

aspitzer
  • 977
  • 5
  • 14
-1

It seems that configure sendmail to send through Gmail SMTP is easier for you.

quanta
  • 51,413
  • 19
  • 159
  • 217