Schedule a script to check mail?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Schedule a script to check mail?
# 1  
Old 02-17-2004
Network Schedule a script to check mail?

Hi,

I'd like to somehow schedule a task on my webserver, such that my account's mail is checked every 10-15 minutes and:

a) any new e-mails received from a particular address are POST-ed to a PHP webpage on my server.

b) any new e-mails received from a different particular address are auto-replied to.

Not being stunning with Unix, and not being the administrator of the server (and it doesn't have ProcMail or anything like that on it) is there any way I can do this, or am I barking up the wrong tree?

Cheers,

Stu
# 2  
Old 02-17-2004
Have a look at the mailcheck utility. Will do quite a bit
of what you want.

"Mailcheck is a simple, configurable tool that allows multiple
mailboxes to be checked for the existence of new mail
messages. It supports both mbox and maildir-style mailboxes,
for compatibility with most mail transport agents. It also
supports remote POP3 and IMAP mailboxes."

Its available for Linux and probably could be ported to
other OSes with minimum effort.
# 3  
Old 02-18-2004
i recently did something similar just for fun. i have a perl script which dumps the messages in a specified mail spool file. then, this script is run via a cron job which dumps that output to a .html file which in turn is a nice small bbs. a semi-dynamic page, without the extra webserver load! (however you could argue running that perl script ever half hour or whatever is just as much load. but actually with a lot of traffic its less load than if apache did it dynamically). anyway here is the script the way i am using it now:

Code:
#!/usr/bin/perl

# this is the perl script for the BBS section of farragutmarine.com/~joe

use Mail::Box::Mbox;

my $folder = Mail::Box::Mbox->new( folder => '/var/mail/bbs' );
my $head = Mail::Message::Head->new;

foreach my $msg ( reverse ($folder->messages()) )
{


	print "<div align=\"left\"><table border=\"0\" cellpadding=\"5\" cellspacing=\"1\" bgcolor=\"#000000\" style=\"width: 632px; height: 158px;\"><tbody><tr><td bgcolor=\"#eeeeff\"><table border=\"0\"><tbody><tr><td align=\"right\"><font color=\"#000000\">Message:</font></td><td><font color=\"#000000\">",$msg->replyPrelude($head->get('sender')),"<br></font></td></tr><tr><td align=\"right\"><font color=\"#000000\">Subject:</font></td><td><font color=\"#000000\">",$msg->subject(),"<br></font></td></tr></tbody></table></td></tr><tr><td bgcolor=\"#ffffff\">",$msg->body(),"<br></td></tr></tbody></table></div><br>";

}


as you can see, you need the Mail::Box::Mbox perl module.

here are the threads where the great people here helped me to write this :

https://www.unix.com/showthread.php?s...ht=MailBoxMbox
https://www.unix.com/showthread.php?s...ht=MailBoxMbox

Last edited by norsk hedensk; 02-18-2004 at 02:18 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Check file if not found send mail if exit call second script

I need to check my script and change to working mode. currently it was not sending the mail and exit without calling the second script. I need to check the file is present ="/home/Rvtools/test.csv" if this file not found after the time retry send mail file not found If the file exit run the... (2 Replies)
Discussion started by: ranjancom2000
2 Replies

2. UNIX for Beginners Questions & Answers

Need in for a script that should check for errors in multiple log file (approx 2500) and should mail

hello everyone, I am new to linux and got this deliverable to write a script that should check for error in multiple log file (count is approx 2500 log files on single server) and once error is found, it should mail that error My logic says: we can put all log files path/location in one... (2 Replies)
Discussion started by: Pratik_CTS
2 Replies

3. Shell Programming and Scripting

Check pending mail in mail queue

I know the command mailq can check the pending mail in mqueue , and also have another command to check POSIX mail queue in server , now I will regularly check the mqueue manually , it is time consuming , would advise the script that could help to check the mail queue , and then send the details to... (3 Replies)
Discussion started by: ust3
3 Replies

4. Shell Programming and Scripting

How to write this script:- check output word and send a mail?

Hi Guys, I am not Good at scripting. I need to write a script such that if output of command shows the particular word in output then send mail to abc@compay.com -bash-3.2$ ps -ef | grep bpbkar root 6040 1 0 13:05:19 ? 0:00 bpbkar -r 2678400 -ru root -dt 47395 -to 0... (20 Replies)
Discussion started by: manalisharmabe
20 Replies

5. UNIX for Dummies Questions & Answers

Schedule the Script

I have wriiten one script to get some results from log files. Daily I have to run the script using the below command to get the output. What I need is, Can I schedule the Script to execute once every day at a particular Time and get the output by mail automatically? I heard about 'cron job' . .... (3 Replies)
Discussion started by: Padmanabhan
3 Replies

6. Shell Programming and Scripting

perl script to check the mail ids in the correct format or not

Hi Folks, I have few mailids in a text file and need to check whether the mailid is in correct format or not. If just to check whether the string is a mailid or not there is a perl module Email::Valid to do the business or we can implement our own logic. But the mail_ids I am having is... (4 Replies)
Discussion started by: giridhar276
4 Replies

7. Shell Programming and Scripting

Mail not attaching the attachment when schedule in crontab

Hi , Iam want to send the mail with attachment , iam using below in my script uuencode /path/pathname/filename filename.csv | mailx -s "subject of mail" vinoth@xxx.com when i trigger the script manually from command prompt i can get with the attachment but when i schedule it in crontab... (4 Replies)
Discussion started by: vinothsekark
4 Replies

8. Shell Programming and Scripting

check postfix deferred mail and send notification script

Hi Guys, I have a postfix server which is deferring emails. Now I need to send notification to a specific email address if: The sender of the deferred email is: abc@example.com Contains specific subjects: a file (/opt/subjects) contains all the subjects in place Then need to send a... (0 Replies)
Discussion started by: linuxrulz
0 Replies

9. UNIX for Dummies Questions & Answers

unix script to check if rsh to box and send status mail

rshstatus=`rsh -n lilo /db/p2/oracle/names9208/restart_names.sh` if $rshstatus <>0 then errstatus=1 mailx -s "xirsol8dr" ordba@xxx.com >> $log_dr else if errstatus=0 echo "status to xirsol8dr successful" can anyone provide if this is t he correct way to do this or is there a better way? (1 Reply)
Discussion started by: bpm12
1 Replies

10. Shell Programming and Scripting

Script Schedule Scrutiny

Hi All, Here's one that may belong in the Scripting Thread but I thought I'd start off here. Here's the scenario:- I have to transfer the functionality and data from an old E450 to a nice new Sun V440. The E450 contains a bunch of scripts which may or may not still be in use daily,... (2 Replies)
Discussion started by: geralex2
2 Replies
Login or Register to Ask a Question