Mail command in a shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Mail command in a shell script
# 1  
Old 04-21-2006
Mail command in a shell script

i wanted to write a shell script that can automatically read unread mails and copy each one into a different file. I was trying to use the MAIL command to do it, but this command requires user input inbetween, I was wondering how that could be achieved in a shell script.
Can sumone please suggest a way out. Thanks

any other command that can be used to achieve the same will also be welcome Smilie .
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

A shell script to run a script which don't get terminated and send a pattern from the output by mail

Hi Guys, I am very new to shell script and I need your help here to write a script. Actually, I have a script abc.sh which don't get terminated itself. So I need to design a script to run this script, save the output to a file, search for a given string in the output and if it exists send those... (11 Replies)
Discussion started by: Sambit Sahu
11 Replies

2. Red Hat

Mail command in script

Dear Concern, We use following mail command in a script. We want to modify below command in script so that we can set mail as CC, BCC and From field of mail also can be modified. Please suggest. echo "The SFTP user account '"$username"' will be expired soon. If you want to extend your... (1 Reply)
Discussion started by: makauser
1 Replies

3. Shell Programming and Scripting

Shell Script To E-Mail

Hi All, I'm having some problems with my shell script. When running the script I get the following errors: line 101: <html>: command not found line 105: /dumpfile.txt: No such file or directory The file dumpfile.txt does exist and I have double and tripple checked this. I'm not sure... (14 Replies)
Discussion started by: SalientAnimal
14 Replies

4. UNIX for Dummies Questions & Answers

How to send e-mail from shell script ( C shell )?

Hi , How to send e-mail from shell script ( C shell ) . Mailx command is not working ( It didn't giving error also ). Please help me (2 Replies)
Discussion started by: arukuku
2 Replies

5. Shell Programming and Scripting

print output of a command in same as shell in mail : please help

i have written a simple script to print the out of a command and send an mail but i am not getting a shell output here .please see my script present output is like this i need an output as same as shell Postfix log summaries for Jan 24 Grand Totals ------------ messages 1432 received 1439... (2 Replies)
Discussion started by: unimaxlin
2 Replies

6. Shell Programming and Scripting

Mail shell script

Hi All, I want to send mail to multiple users.. Currently I am using below script cat $STATUS_FILE|mailx -s "$SUBJECT" -r xxx@yyy.com $MAILTO How can i give cc or bcc to in this script Please help me thanks in advance Regards RG (3 Replies)
Discussion started by: rgumm
3 Replies

7. Shell Programming and Scripting

attaching file in mail command from shell script

Hi all, Currently in shell script i am using the following command to send mail echo "Certain assets are not loaded properly. PFA the result of the DataLoad" | mail -s "Weekly DataLoad - Failure Notification !!" $MAILINGLIST I need to attach a file along with that. How should i handle this... (7 Replies)
Discussion started by: ananthi_ku
7 Replies

8. Shell Programming and Scripting

shell script to send a mail

Hi, I need a shell script which runs in the backround for all the 24 hours and send a mail to us regarding the output of the prstat command when the load average increase above certain percent. kindly help me on this...... (1 Reply)
Discussion started by: jayaramanit
1 Replies

9. Shell Programming and Scripting

How to use mail,mailx command in Shell Script ?

Hi.. How can i use mailx,mail command in Shell Script. Suppose i gave a condition that x value is above 25 send a mail alert to abc@rediffmail.com. How can i do this? Regards Sollin (16 Replies)
Discussion started by: sollin
16 Replies

10. UNIX for Dummies Questions & Answers

Script to e-mail me when a command is done

I am using aix 5.1 I am trying to put a line in a command script to e-mail myself when a command is done. I am not sure what that is . Could somebody help me ? Thanks (2 Replies)
Discussion started by: rocker40
2 Replies
Login or Register to Ask a Question
escape(1)							Mail Avenger 0.8.3							 escape(1)

NAME
escape - escape shell special characters in a string SYNOPSIS
escape string DESCRIPTION
escape prepends a "" character to all shell special characters in string, making it safe to compose a shell command with the result. EXAMPLES
The following is a contrived example showing how one can unintentionally end up executing the contents of a string: $ var='; echo gotcha!' $ eval echo hi $var hi gotcha! $ Using escape, one can avoid executing the contents of $var: $ eval echo hi `escape "$var"` hi ; echo gotcha! $ A less contrived example is passing arguments to Mail Avenger bodytest commands containing possibly unsafe environment variables. For example, you might write a hypothetical reject_bcc script to reject mail not explicitly addressed to the recipient: #!/bin/sh formail -x to -x cc -x resent-to -x resent-cc | fgrep "$1" > /dev/null && exit 0 echo "<$1>.. address does not accept blind carbon copies" exit 100 To invoke this script, passing it the recipient address as an argument, you would need to put the following in your Mail Avenger rcpt script: bodytest reject_bcc `escape "$RECIPIENT"` SEE ALSO
avenger(1), The Mail Avenger home page: <http://www.mailavenger.org/>. BUGS
escape is designed for the Bourne shell, which is what Mail Avenger scripts use. escape might or might not work with other shells. AUTHOR
David Mazieres Mail Avenger 0.8.3 2012-04-05 escape(1)