Register
It is currently Sat Jul 26, 2014 1:06 am

Mail in bash


All times are UTC - 6 hours


Post new topic Reply to topic  [ 3 posts ] 
Author Message
 PostPosted: Thu Jun 29, 2006 10:06 pm   
User avatar

Joined: Tue May 17, 2005 12:55 am
Posts: 86
Location: Big Easy, Louisiana
I read in my new book from crouse, that you can send emails in bash. what do i need to edit to do this :?


Top
 Profile YIM  
 PostPosted: Fri Jun 30, 2006 2:07 pm   
Moderator
User avatar

Joined: Wed May 03, 2006 2:05 pm
Posts: 242
Hey Coastie,

I haven't read the book so I'm not sure this is exactly what you're looking for, but if you have an MTA installed on the machine, it's usually just a matter of the "mail" command.

# echo "this is my message..." |mail user@domain.com -s"subject goes here"

-Jeo


Top
 Profile YIM  
 PostPosted: Sun Jul 02, 2006 2:56 am   

Joined: Fri Oct 14, 2005 9:30 am
Posts: 61
Cheers for that jeo - that's something new to play around with.
That could easily be adapted into a script as follows:
Code:
#!/bin/bash
read -p "Who do you want to email (foo@bar.com) : " email
read -p "What do you want the subject to be : " subject
read -p "What do you want the message to read : " message
echo "$message" | mail $email -s "$subject"

Also in that I would probably add a function to check that the mail command existed.
What program do I need for the mail command?


Top
 Profile WWW  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP