LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-25-2004, 05:10 PM   #1
ntan81
LQ Newbie
 
Registered: Oct 2004
Location: Mississippi
Posts: 3

Rep: Reputation: 0
shell script and mail


I am attempting to write a script that will check an email account and mail me a list of users (from the "From" field) that have sent mail to that account in the last 24 hours. Ill use cron to do this once a day. The script will run on the same mail server as the account.

Can someone point me to a good reference or examples of how I can have a script interact with mail in this way? This will be my first major attempt at scripting in Linux.

Thanks in advance!
 
Old 10-25-2004, 10:18 PM   #2
1337 Twinkie
Member
 
Registered: Jul 2004
Distribution: Fedora Core 2
Posts: 79

Rep: Reputation: 15
What language were you planning on using (Bash, Python, etc...)? I know that Python has some functions that deal with email.

Here is the Python Library Reference . Check out the the section on 'net protocols (near the bottom). There is all kinds of stuff for handling email.
 
Old 10-26-2004, 08:53 AM   #3
ntan81
LQ Newbie
 
Registered: Oct 2004
Location: Mississippi
Posts: 3

Original Poster
Rep: Reputation: 0
I was thinking of using bash, but I wouldn't be opposed to using something different, although I would have to learn it.

What are the pros and cons of using bash?
What are the pros and cons of using Python?
Whats the learning curve on Python look like?
 
Old 10-26-2004, 10:32 AM   #4
Cedrik
Senior Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140

Rep: Reputation: 244Reputation: 244Reputation: 244
you could use Perl (and Bash too but I prefer Perl), the idea is to
parse the right files in ~/Mail dir or similar dir , depending on your
mail client.
 
Old 10-29-2004, 03:55 PM   #5
ntan81
LQ Newbie
 
Registered: Oct 2004
Location: Mississippi
Posts: 3

Original Poster
Rep: Reputation: 0
I've decided to just write a shell script.

Is there a command I can use from my script that will empty the contents of /var/mail/user

The script is going to run once a day, and after it finishes running, i need it to clear out the inbox and get ready for the next day's round of mail.

Thanks in advance!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell Scripting: Getting a pid and killing it via a shell script topcat Programming 15 10-28-2007 02:14 AM
shell script problem, want to use shell script auto update IP~! singying304 Programming 4 11-29-2005 05:32 PM
Writing shell script with mail < logfile humbletech99 Programming 2 11-22-2005 08:20 AM
Shell script sending mail mfrick Linux - General 5 09-01-2005 07:46 PM
How do I zip and attach the output data of a grep | awk | mail shell script? 360 Programming 1 05-08-2002 08:26 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration