[TriLUG] script to send email

Magnus magnus at trilug.org
Mon Oct 29 10:21:49 EDT 2007


Wing D Lizard wrote:
> I'd like to use a script to automatically send an email out daily.  My 
> box is a generic fedora 7 using dyndns.org.
> 
> does anybody have a script to do this?  

man mail

Yes, it's really that easy.  Pipe the output of your script into mail,
pass the subject and recipients as arguments to mail.

> How is authentication handled?  

For sending?  You don't, generally.

> Specifically, I want to add a cron job with 'wget 
> http://www.showmyip.com | grep displaycopy | mail_script brettb at trilug.org'
> so I can get my nc.rr.com dynamic ip sent to my trilug account.


wget --quiet -O - http://www.showmyip.com | grep displaycopy | mail -s
"my IP address" brettb at trilug.org

I'll do you one better.

http://trilug.org/~magnus/showmyip.php



More information about the TriLUG mailing list