Mail shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Mail shell script
# 1  
Old 06-14-2010
Question 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
# 2  
Old 06-14-2010
on Solaris 10, I see both -c and -b options:

Code:
-> man mailx |less -N 
 done
      1 
      2 
      3 
      4 User Commands                                            mailx(1)
      5 
      6 
      7 
      8 NAME
      9      mailx - interactive message processing system
     10 
     11 SYNOPSIS
     12      mailx [-BdeHiInNURvV~] [ -f
     13       [file | +folder] ] [-T file] [-u user]
     14 
     15      mailx [-BdFintUv~] [-b bcc] [-c cc] [-h number] [-r address]
     16      [-s subject] recipient...
     17 
     18      /usr/ucb/mail ...
     19 
     20      /usr/ucb/Mail ...
     21 
     22 DESCRIPTION
     23      The mail utilities listed above provide a comfortable, flex-
     24      ible  environment  for  sending  and receiving mail messages
     25      electronically.
     26 
     27      When reading mail, the mail utilities  provide  commands  to
...

This User Gave Thanks to curleb For This Post:
# 3  
Old 06-14-2010
Code:
echo hello | mailx  -s "test" -c test2user -b testuser root

Code:
 
echo hello | mailx  -s "test" -c ygemici@mailx.com -b ygemici2@mailx.com ygemici@redhat.com

This User Gave Thanks to ygemici For This Post:
# 4  
Old 06-15-2010
Quote:
Originally Posted by ygemici
Code:
echo hello | mailx  -s "test" -c test2user -b testuser root

Code:
 
echo hello | mailx  -s "test" -c ygemici@mailx.com -b ygemici2@mailx.com ygemici@redhat.com



I was tried above yesterday but it didn't work....

cat $STATUS_FILE|mailx -s "$SUBJECT" -r rgumm@yyy.com -bcc rgumm@zzz.com

I have received System Administrator

Your message did not reach some or all of the intended recipients.
Subject: Daily Health Checks
Sent: 6/14/2010 6:05 PM
The following recipient(s) could not be reached:
c@1234.yyy.com on 6/14/2010 6:05 PM
The e-mail account does not exist at the organization this message was sent to. Check the e-mail address, or contact the recipient directly to find out the correct address.
< 1234.yyy.com #5.1.1 SMTP; 550 5.1.1 <c@1234.yyy.com>... User unknown>


---------- Post updated at 04:35 AM ---------- Previous update was at 04:15 AM ----------

Thanks Guys.. Now i got the answer..

I have give -bcc instead of -b and -cc instead of -cc

Thakns to all

regards
RG
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. Shell Programming and Scripting

To send a mail through shell script

I want to send a mail through shell script,If it is possible Please give me a code. mail id : upload.xxx@example.com (8 Replies)
Discussion started by: kannansoft1985
8 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. Shell Programming and Scripting

Sending Mail via shell script

I am in need of a script that will send out emails while going through a NAT. What I have that works is as follows: display_remote_IP | sort | uniq | while read i do FOUND=0 for IP in `echo $ACCEPTABLEIP` do if ; then FOUND=1... (2 Replies)
Discussion started by: ldapguy
2 Replies

5. Shell Programming and Scripting

Sending mail from shell script

Hello All, I m trying to send mail from my unix script, I have used the below command mailx -s 'hi' email address < temp.txt It is not giving me any error,but I couldn't receive the mail Can you please help me. Many Thanks, Pragyan (6 Replies)
Discussion started by: prarat
6 Replies

6. 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

7. Shell Programming and Scripting

sending a mail using shell script

Please help me in writing the script for sending an attachment through email.(For example my text file name is :abc.txt and it is in directory d:/abc) (1 Reply)
Discussion started by: anitha126
1 Replies

8. Shell Programming and Scripting

Shell script to send a mail

Hi , I need to prepare a script which will check my database with specific to particluar table. If the row count exceeds a certain limit, i need to send a mail to a set of Recipients. Being new to unix, please guide me to complete this task. Advance thanks, Sekar. (4 Replies)
Discussion started by: Sekar1
4 Replies

9. 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

10. Shell Programming and Scripting

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... (0 Replies)
Discussion started by: garric
0 Replies
Login or Register to Ask a Question