Email ids trucated in Mailx function

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Email ids trucated in Mailx function
# 1  
Old 08-12-2011
Email ids trucated in Mailx function

I wanted to send email to list of people using mailx in unix. I am getting the emailds from a oracle table and getting the ids in a variable. Shell script is shown below:
filename=testdata921 export filename
UTLFILE_DIR=/tmp1/test export UTLFILE_DIR
sqlplus -s $Username/$Pwd@$Database <<EOF
set heading off
set feedback off
select email_address from email_list where APPLICATION='TESTDATA921';
echo "$mailids"
sqlplus << EOF
whenever sqlerror exit failure;
execute PRC_FILE_GENERATE; --this generates testdata921 file
if [ $RC = 0 ]
echo "SQL executed successfully...."
unix2dos $filename.csv $filename.tmp
(uuencode $filename.tmp $filename.csv) | mailx -s "TESTDATA921 File" $mailids
echo "SQL was NOT successfully executed...."
echo "Program exited with RC=$RC"
exit $RC

Output of below sql query is
select email_address from email_list where APPLICATION='TESTDATA921';,,

It should send email to all the three persons. But if you see the output of echo in the unix screen it is

bash-3.00$ int1247_syst_1.ksh,,Nagamarimuthu.Karupp

So I am getting email with TO addresses as

where amrndhp0001g is server name
Can anyone tell why is it so? Do i need to do something while getting the addresses in variable.

Note: If i assign the email ids directly to the variable mailids, it works fine.

Last edited by pludi; 08-12-2011 at 04:56 PM..
# 2  
Old 08-12-2011
what do you mean assign email ids directly works?
do you mean the below works?
(uuencode $filename.tmp $filename.csv) | mailx -s "TESTDATA921 File",,

Last edited by dude2cool; 08-12-2011 at 06:00 PM.. Reason: edit
# 3  
Old 08-12-2011
Yes, if i assign

This works fine. but calling SQL code and then assigning the output of SQL is not working, if I give more than two IDs. It is restricting to some length.
# 4  
Old 08-14-2011
Please, somebody help me with this. Thanks.
# 5  
Old 08-14-2011
try this, see if it makes any difference:
(uuencode $filename.tmp $filename.csv) | mailx -s "TESTDATA921 File" `echo "$mailids"`

# 6  
Old 08-15-2011
@dude2cool, Thanks for your help. But this also didnt work.

I tried the below code and i'm able to send the email now.

echo "select email_address from grw_email_list where APPLICATION='BEVDATA921';
" | sqlplus -s $Username_ODS/$Pwd_ODS@$Database_syst | \
while read line
if [[ $i -gt 2 ]]
b=" "
while [ $i -lt ${#arr[@]}-1 ]
if [ $i -eq ${#arr[@]}-2 ]
(( i=i+1 ))
infile=`echo "$email_suc" | sed 's/ //g'`

And then used the "infile" in
(uuencode $filename.tmp $filename.csv) | mailx -s "BEVDATA921 File" "$infile"
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Email IDs added to .mailrc aliases not receiving mails

hi, I added an email id to a list of existing aliases in .mailrc on my unix box, using vi editor. However, the new id has not been receiving any mails from the box. Kindly help as to what needs to be done here. Does the box need to be rebooted for these changes to reflect? Is there any other... (5 Replies)
Discussion started by: qwerty000
5 Replies

2. Emergency UNIX and Linux Support

Email ids from gecos

I would like to extract only the email ids from the gecos of each user id. I have to get the email ids of all the users on the server like this. Can someone please assist me with the command/script? (15 Replies)
Discussion started by: ggayathri
15 Replies

3. Shell Programming and Scripting

Masking email ids / phone no's in file along with obscene words

Hi, I would like to know if there is a way to mask obscene words and other contents like email id's/phone numbers in the file. Below is the sample input /output. Sample data : cat smp.txt The service is really bad . My email You can contact me at 4078909831 Output... (2 Replies)
Discussion started by: ashwin3086
2 Replies

4. Shell Programming and Scripting

Send Email to group ids

hi, I want to send mail to DL... i am sending email to single id using mailx .. how to send to group of ids? :confused: i am using a file which conatins all the ids, is there any other way to send mail without creating the DLfile? DL=path\file.txt mailx -s "Info BG is now... (4 Replies)
Discussion started by: sreelu
4 Replies

5. HP-UX

Sending email to multiple IDs

Hi, I am trying to send an email to multiple IDs from Unix script. I have given the EmailIds in a file and trying to use the file as input in the script. > cat Email EmailID = "" In my script I have . /Email mailx -s "subj" $EmailID This fails with the... (3 Replies)
Discussion started by: sangharsh
3 Replies

6. UNIX for Dummies Questions & Answers

mailx - mail ti ids containing ampersand

Hi I am trying to send mail to an email id having ampersand in it. Like abc.& But it is not being sent. I also tried prefixing backslash before and after ampersand Need Help:( (17 Replies)
Discussion started by: aniruddha.saha
17 Replies

7. UNIX for Dummies Questions & Answers

Sending mails to various users without hard coding the email IDS

Hi Can any one help me out ? I am trying to send an autogenerated mail with an attachment to bulk of users using 'MAILX' and 'UNENCODE' . I have used it as follows X " ( cat /sastemp/body.txt; uuencode Test.xls.gz Test.xls.gz ) | mailx -s 'Testing' ' , ' " ... (9 Replies)
Discussion started by: manas6
9 Replies

8. Forum Support Area for Unregistered Users & Account Problems

Please list email ids or contact info of members

Hi , Is it possible to list the user's email id for further communication. Thanks, MoonwalaPL (3 Replies)
Discussion started by: moonwalapl
3 Replies

9. Shell Programming and Scripting

Prallel function with different shell ids

Hi, I have a script as follows func1() { echo $$ } func1 func1 This returns the id of the current shell twice so outputs: 4201 4201 I'd like to change this script so the function is called in a different subshell each time, giving a different shell id for each function call.... (6 Replies)
Discussion started by: Fl3tchLiv3s
6 Replies

10. UNIX for Advanced & Expert Users

Unable to send eMail from a UNIX-Host ( using mailx ) to a Outlook-email-addres(Win)

Hi A) I am able to send eMail using mailx from a UNIX ( solaris 8 ) host to my Outlook-email-ID : ( This is NOT my actual -eMail-ID). But in Outlook the "From :" eMail address is displayed as " " .i.e the words... (2 Replies)
Discussion started by: Vetrivela
2 Replies
Login or Register to Ask a Question