Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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!

share|improve this question
    
possible duplicate of Setup ubuntu server to send mail() –  GregD Nov 19 '10 at 12:11
    
add comment

4 Answers

up vote 3 down vote accepted

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.

share|improve this answer
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
    
thanks cstamas! –  Thibaut Barrère Nov 20 '10 at 15:57
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
show 1 more comment

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.

share|improve this answer
    
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
add comment

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

share|improve this answer
add comment

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

share|improve this answer
    
I think this is neither easy nor necessary. –  cstamas Nov 19 '10 at 12:50
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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