The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Schedule an interactive shell script Chaitrali Shell Programming and Scripting 4 11-08-2007 08:49 AM
set schedule to run a script at background while logout happyv Shell Programming and Scripting 1 01-23-2007 10:17 PM
command to schedule a unix script in tidal' scheduler balireddy_77 UNIX for Advanced & Expert Users 0 10-09-2006 09:03 PM
Script Schedule Scrutiny geralex2 Shell Programming and Scripting 2 08-29-2006 12:52 AM
How can I schedule a script on Solaris? krikets Shell Programming and Scripting 3 10-06-2003 06:29 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 02-17-2004
Registered User
 

Join Date: Feb 2004
Location: Oxford, UK
Posts: 1
Angry 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
Reply With Quote
Forum Sponsor
  #2  
Old 02-17-2004
Moderator
 

Join Date: Dec 2003
Location: /dev/florida
Posts: 1,038
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.
Reply With Quote
  #3  
Old 02-17-2004
Registered User
 

Join Date: Jul 2002
Location: new york
Posts: 1,025
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 :

Email formatting
perl script

Last edited by norsk hedensk; 02-17-2004 at 11:18 PM.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 03:55 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0