2

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!

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.

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

  • 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

-1

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

  • I think this is neither easy nor necessary. – cstamas Nov 19 '10 at 12:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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