Thanks to all.... The list is endless...to name a Few... Crist Clark Francisco Eric Scisson Alex Kruchkoff Bill R Willams Bochnic Williams J Lovely David P Owens Blaine C - Eastman Broun Bevan Michael DeSimone Alan Crosby Pankaj Agarwal Ian Clements Special thanks to Francisco and Crist Clark for providing me extended support.. Well there are many ways this can be achieved, the only problem being a security Risk and some have suggested using PGP encryption in the shell script. Well if anyone can send me such script will be of great Help.. Method I ---------- In /etc/aliases, add something like: targetaddress: "|/path/to/your/script" After this run newaliases and any email sent to targetaddress will kick off the script.. Method II ------------- Install procmail. It can downloaded from http://www.procmail.org/ The procmail rule you would need would probably look something like this: :0 * ^From.*sender * ^Subject:.*scriptname | script Method III ----------- Under the account on Solaris create a file named .forward in the home directory with the following entry: | /path/to/script To check email From and Subject field before triggering the script I would have the command you send the email to check the email message. Just checking the "From" address is probably not secure enough either. For example, if you have this in your aliases, runscript |/usr/local/bin/mailcheck A script like this checks the "From:" address and a static password (which still probably is not secure enough, a one-time password is probably the easiest thing to do, but beyond what I'm going to write up as an example), $ cat /usr/local/bin/mailcheck #!/usr/bin/perl $script=/path/to/script; $password = "your password"; $addr_match = 0; $pwd_match = 0; while (<>) { if (/^From: My Address <my_address\@example\.com>/) { $addr_match = 1; } elsif (/^password: $password$/) { $pwd_match = 1; } } open(LOGFILE, ">/var/log/mailcheck.log"); if ($addr_match && $pwd_match) { print LOGFILE scalar(localtime()) . " running script, $script\n"; exec $script || print LOGFILE scalar(localtime()) . " failed to exec $script\n"; } elsif ($addr_match) { print LOGFILE scalar(localtime()) . " no password or incorrect password.\n"; } elsif ($pwd_match) { print LOGFILE scalar(localtime()) . " incorrect \"From\" line.\n"; } else { print LOGFILE scalar(localtime()) . " bad password and \"From.\"\n"; } Thanks a lot to all Gurus... B My original post was: Hi Gurus, I have a strange requirement. Hope someone can help me in this. Is there anyway we can kick the shell script from email? If I send an email from Blackberry or outlook Inbox to Sun Server and after receiving the email it should kick off the shell script. Also if Sun Server has to receive an email what needs to be done other than starting sendmail daemon? Any Help will be greatly appreciated. TIA B _______________________________________________ sunmanagers mailing list sunmanagers@sunmanagers.org http://www.sunmanagers.org/mailman/listinfo/sunmanagers _______________________________________________ sunmanagers mailing list sunmanagers@sunmanagers.org http://www.sunmanagers.org/mailman/listinfo/sunmanagersReceived on Thu Feb 17 20:38:48 2005
This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:43:43 EST