mailx problem with multiple cc


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting mailx problem with multiple cc
# 1  
Old 07-02-2010
mailx problem with multiple cc

I am writing a script to send an email of the result of the process but i cannot make the cc work correctly.

Code:
RECIP="abc@example.com def@example.com"
CC="ghi@example.com jkl@eaxmple.com"
mailx -s "testing" -c $CC $RECIP < inputfile.txt

Result:
Code:
To: abc@example.com; def@example.com; jkl@eaxmple.com
Cc: ghi@example.com
Subject: Testing
< some text here>

The cc is not working correctly on multiple recipient. I tried put the CC inside the double quotes like below but its not sending an e-mail at all.
Code:
mailx -s "testing" -c "$CC" $RECIP < inputfile.txt

Any help is greately appreciated.
# 2  
Old 07-02-2010
Try,

Code:
mailx -s "testing" -c \"$CC\" $RECIP < inputfile.txt

# 3  
Old 07-02-2010
Quote:
Originally Posted by agn
Try,

Code:
mailx -s "testing" -c \"$CC\" $RECIP < inputfile.txt

I also tried that same thing but it just hang Smilie
# 4  
Old 07-02-2010
Quote:
Originally Posted by The One
I am writing a script to send an email of the result of the process but i cannot make the cc work correctly.

Code:
RECIP="abc@example.com def@example.com"
CC="ghi@example.com jkl@eaxmple.com"
mailx -s "testing" -c $CC $RECIP < inputfile.txt

Result:
Code:
To: abc@example.com; def@example.com; jkl@eaxmple.com
Cc: ghi@example.com
Subject: Testing
< some text here>

The cc is not working correctly on multiple recipient. I tried put the CC inside the double quotes like below but its not sending an e-mail at all.
Code:
mailx -s "testing" -c "$CC" $RECIP < inputfile.txt

Any help is greately appreciated.
try this...

RECIP="abc@example.com,def@example.com"
CC="~c ghi@example.com,jkl@eaxmple.com"
echo $CC >tempfile
cat tempfile inputfile.txt | mailx -s "testing" $RECIP
# 5  
Old 07-02-2010
I agree with Kattoor. The separator for mail address lists is a comma.
(For some strange reason Microsoft use a semi-colon in their user interface).
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Mailx, Table, Multiple Email script

Hello, I am able to write some simple scripts in linux but this time it seems a little bit hard for me. Objective: Script will read Database.txt file and will submit separate emails to multiple persons. Database.txt Elvis-Presley user_ssh1 ##20140403 firstperson@gmail.com Julia-Roberts... (3 Replies)
Discussion started by: baris35
3 Replies

2. UNIX for Dummies Questions & Answers

Problem getting mailx to send true Bcc mail to multiple recipients

I am having trouble getting mailx to send multiple Bcc mails out without everyone in the list of recipients seeing everyone else's email addresses. I looked at the man pages of my system and seem to be following the syntax correctly, but the mails still go out as if I were just putting in a list of... (7 Replies)
Discussion started by: legrandtimonier
7 Replies

3. Shell Programming and Scripting

Sending Multiple Attachments using MAILX

I have created a shell scripts and wanted to email users multiple attachments using mailx. I noticed that when I do a man on mailx I see and -a option for attachments. When I run a: mailx -s "test attachments" -a include_file -a exclude_file testuser@mydomain.com (Interrupt -- one more to... (1 Reply)
Discussion started by: metallica1973
1 Replies

4. Shell Programming and Scripting

mailx script to do multiple emails

I am looking for a script that I can use with mailx to do the following: 1. Grab usernames from a flat file (one at a time) 2. Attach a file to the email and mail out. Thanks. Cubefeed (3 Replies)
Discussion started by: CubeFeed
3 Replies

5. Shell Programming and Scripting

Not able to send multiple attachments using uuencode and mailx

Hi, I am seeing some junk characters when I attach the second file, given below is the logic I used. Please help me resolving the issue. ( uuencode file1.txt file1.txt.lst && uuencode file2.txt file2.txt.lst ) > attachment.txt cat body.txt attachment.txt > combinemail.txt mailx -m... (7 Replies)
Discussion started by: prasperl
7 Replies

6. Shell Programming and Scripting

uuencode mailx - send multiple emails

The following is an extract from one of my Shell Scripts which uses uuencode and mailx to send an email with multiple attachements: uuencode $LOG_REPORT $(basename $LOG_REPORT) uuencode $HTML_FILE $(basename $HTML_FILE ) ) | if then mailx -b "$COPY_TO" -s "$SUBJECT" -r "$MAIL_FROM"... (2 Replies)
Discussion started by: suthera
2 Replies

7. UNIX for Dummies Questions & Answers

using mailx with multiple recipients

I am trying to use a file containing email addresses in my mailx command like the following: SUBJECT="Kronos User Report" BODY="kronos.txt" MAILTO="kronosmail.txt" mailx -s "$SUBJECT" $MAILTO < $BODY This works fine for the body of the message but for the recipient it says: ... (6 Replies)
Discussion started by: sdhalepaska
6 Replies

8. UNIX for Advanced & Expert Users

Problem with multiple excel attachments using mailx

I have written the following code send multiple attachments using mailx (uuencode file1 file1; uuencode file2 file2; uuencode file3 file3;) | mailx -s MultipleAttachments -r Sysadmin abc@xyz.com The attachments are coming properly if the file1,2,3 are either pdf, text, doc. But if these files... (2 Replies)
Discussion started by: ramanam2004
2 Replies

9. Shell Programming and Scripting

Using mailx to send email to multiple users.

Hi, I am using the mailx command to send email to multple users. The command works fine when i am sending mail to a single user but when i insert multiple email ids inside the quote it does not work. All the email ids are coming from a property file.Please have a lookt at the property file and... (4 Replies)
Discussion started by: priyaksingh
4 Replies

10. UNIX for Dummies Questions & Answers

Multiple File Attachment Using Mailx

HI, I want to send mail using mailx and also want to attach all files under specific directory.(*.*). Please show me a script. Thanks (3 Replies)
Discussion started by: pnathani
3 Replies
Login or Register to Ask a Question