Sponsored Content
Top Forums Shell Programming and Scripting Run a script based on the subject line of the email Post 302305701 by nobody4 on Thursday 9th of April 2009 02:05:48 PM
Old 04-09-2009
You probably need to spec this a bit better.
It's not clear whether you need help with writing the "dojob.sh" script,
or with taking the subject line and using the information in it to invoke
the command "dojob.sh job1 copy1"

You might be looking for this:

$ sed -n -e 's/^Sub:.*job=\(.*\) copies=\(.*\)$/dojob.sh \1 \2/p' emailfile
dojob.sh job1 copy1

...which you could pipe to a shell to get it executed.



Curious people might want to know whether you have some way of intercepting
the emails and processing them automatically as they come in,
or if you plan to do this manually with copy/paste and your email client (for example).
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

use email subject line as shell command

If anyone can give me some ideas on this it would be great. What I'm trying to do is to have emails be sent to my unix account. Once they are emailed to the unix account, I want to use the text in the subject field to invoke a shell script, so basically I need to find a way that I can... (4 Replies)
Discussion started by: mskarica
4 Replies

2. UNIX for Dummies Questions & Answers

run a script from incoming email

hi I have a bit of a problem i need help with. I have a script that runs no problems when i run it manually. as soon as i stick in tester: /app/scripts/run.pl into /etc/aliases & try to run it by sending a mail it doesnt work. the output files are owned by daemon, which i dont like & think... (7 Replies)
Discussion started by: jojo77
7 Replies

3. Shell Programming and Scripting

help with script to send email and if subject line match is found

Help with script that will check log, then find a match is found, add that as the subject line. 1. The script will always run as a deamon.. and scan the event.log file 2. when a new 101 line is added to the event.log file, have the script check position 5,6 and 7 which is the job name, which... (2 Replies)
Discussion started by: axdelg
2 Replies

4. Linux

Run PHP script when new email received

I have been looking around for a solution to this, i have been developing for a wile though am very new to CGI, PHP and a lot of the web based tech. I have a web site hosted with a cPanel web host. I am looking to have a script(prefer PHP) to run everytime i get a new email to help@xxx.com.... (16 Replies)
Discussion started by: iKris
16 Replies

5. Shell Programming and Scripting

Subject line of an email

Hi all, I am trying to automate a process in which at the end of the process the script should send an email to the user saying this process is completed. I have done everything but the problem now is the subject line of the email... the subject line looks like this.. where abc xyz is a... (4 Replies)
Discussion started by: smarty86
4 Replies

6. Shell Programming and Scripting

help with email to be triggered based on fatal error detection from batch run log file neded

Hi, I require need help in two aspects actually: 1) Fatal error that gets generated as %F% from a log file say ABClog.dat to trigger a mail. At present I manually grep the log file as <grep %F% ABClog.dat| cut-d "%" -f1>. The idea is to use this same logic to grep the log file which is... (1 Reply)
Discussion started by: zico1986
1 Replies

7. Shell Programming and Scripting

Run a script when I receive an email

Hi expert I wish to start a shell script when I receive an email. I modified the aliases file and I add this string as400nag: "|/home/nag-script/startstop/AS400-Boot.sh The solution works . When the as400nag user receive an email the /home/nag-script/startstop/AS400-Boot.sh starts .but... (3 Replies)
Discussion started by: emi65
3 Replies

8. Shell Programming and Scripting

Sending sql output to email body with conditional subject line

hi , i have written below piece of code to meet the requirement but i am stuck in the logic here. the requirement are: 1) to send the sql out put to email body with proper formatting. 2) if count_matching = Yes then mail should triggered with the subject line ... (10 Replies)
Discussion started by: itzkashi
10 Replies

9. Shell Programming and Scripting

Script that will send an email if the cron job did not run.

Team, Would like to know what is the best script that will send you an email if cronjob did not run. Thanks (4 Replies)
Discussion started by: kenshinhimura
4 Replies

10. UNIX for Beginners Questions & Answers

Variable not displaying in subject line of mailx email

Hi Newbie here with first post. I've got a shell script (ksh) whereby I run a SQL*Plus script and output the results to a file. I then check the output file in an if statement that looks like this: if ]; then export GAPNUM=`awk '{print $4}' $OUTFILE` if ] then mailx -s... (10 Replies)
Discussion started by: ltzwoman
10 Replies
MAILINSPECT(1)															    MAILINSPECT(1)

NAME
mailinspect - sort an mbox by category and pipe emails to a command. SYNOPSIS
mailinspect [-zjiI] -c category FILE [-gG regex]... [-s command] [-p style] [-o scoring] mailinspect -V DESCRIPTION
mailinspect reads the single mbox folder named FILE and sorts it in order of similarity to the category, which must have been created by dbacl(1). It can be used as a command line tool or interactively, when given the -I switch. When used as a command line tool, mailinspect prints the sorted list of emails on STDOUT. Each line consists of a seek position for the given email within FILE, followed by the score and a description string in one of several styles chosen via the -p option. When supplying a command string in conjunction with the -s option, mailinspect spawns a shell and executes command for every email in FILE (possibly selected via the -g or-G options), in the sorted order. This is similar to the formail(1) functionality, except the latter doesn't order the emails. In interactive mode, all the command line functionality is available via keypresses. The sorted list of emails is displayed in a scrollable format, and can be viewed, searched, tagged, resorted and sent to shell commands. Predefined shell commands can be associated with function keys. See the usage section below. The sorting heuristics are currently (and may always be) experimental, so there is no guarantee that the orderings are particularly well suited for anything. EXIT STATUS
mailinspect returns 1 on success, 0 if some error occurred. OPTIONS
-c Use category to compute the scores and sort the emails, which should be the file name of a dbacl(1) category. -g Only emails matching the regular expression regex are sorted. All other emails are ignored. When several -g and -G options are present on the command line, earlier regular expressions are overridden by later ones where applicable. -i Force internationalized mode. -j Force regular expression searches to be case sensitive. -o Determines the scoring formula to be used. The parameter scoring must be an integer greater than or equal to zero. By default, scor- ing equals zero. -p Prints the email index in the given style. The parameter style must be an integer greater than or equal to zero. By default, style equals zero. -s For each email in the list, execute the shell command, with the email body on STDIN. Emails are processed in sorted order. -z Reverse sort order. Normally, emails are sorted in order of closest to furthest relative to category, but in this case, the opposite is true. -I Interactive mode. Instead of printing the sorted list of emails on STDOUT, emails are displayed and can be scrolled, viewed, searched and piped interactively at the terminal. -G Only emails not matching the regular expression regex are sorted. Opposite of -g switch. -V Print the program version number and exit. USAGE
mailinspect needs to read a prelearned category before it can sort the emails in FILE. See dbacl(1). Suppose you have two mail folders named good.mbox and bad.mbox respectively. You can create appropriate categories by typing the commands % dbacl -l good good.mbox -T email % dbacl -l bad bad.mbox -T email Next, you can type the following command to view interactively the bad.mbox file with the emails whose score is closest to the category good listed first: % mailinspect -I -c good bad.mbox Alternatively, you might be interested only in the five emails in the folder bad.mbox whose score marks them as the furthest away from the category bad, completely independently from any other category such as good (ie you want outliers in the scoring sense). % mailinspect -z -c bad bad.mbox | head -5 In interactive mode, the following keys are defined: o toggles another scoring formula. p toggles another display style. q exits mailinspect. s sends the currently highlighted email to a shell command. S sends all currently tagged emails to a shell command, in sorted order. Every email executes the shell command independently. t tags the currently highlighted email. T tags all listed emails. v sends the currently highlighted email to $PAGER for viewing. If the environment variable PAGER is not defined, sends the email to less(1). u untags the highlighted email. U untags all listed emails. z reverses the sort order of displayed emails. / searches for a regular expression (see regex(7)) anywhere within the contents of all listed emails. Hides all emails which don't match. ? like /, but hides all emails which match, keeping all those which don't match. As a convenience, the function keys F1-F10 can each be associated with a shell command string. In this case, typing a function key has the same effect as the S key, but the command is already typed and ready to be edited/accepted. The function key associations are read from the configuration file .mailinspectrc if it exits. FILES
$HOME/.mailinspectrc mailinspect reads the file .mailinspectrc in the $HOME directory, if it exists. This is a plain text file which contains entries of the form # this is a comment F2 cat >> interesting.mbox F5 mail zarniwoop@megadodo.com ENVIRONMENT
DBACL_PATH When this variable is set, its value is prepended to every category filename which doesn't start with a '/'. SOURCE
The source code for the latest version of this program is available at the following locations: http://www.lbreyer.com/gpl.html http://dbacl.sourceforge.net AUTHOR
Laird A. Breyer <laird@lbreyer.com> SEE ALSO
bayesol(1), dbacl(1), less(1), mailcross(1), regex(7) Version 1.12 Bayesian Text Classification Tools MAILINSPECT(1)
All times are GMT -4. The time now is 12:33 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy