Visit The New, Modern Unix Linux Community


sending mail through mailx command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting sending mail through mailx command
# 1  
sending mail through mailx command

Hi
I need help to send mail through mailx command . Currenlt my program is like

Code:
#!/bin/ksh -x
echo "[$(date)] [Script Location $(pwd)] " >>  path.lst
MAIL_LIST='someone1@gamil.com  someone2@gamil.com someone3@gamil.com'
cat  path.lst | mailx -s "path loaction"  $MAIL_LIST
echo "End"
exit 0


Its work fine . But i need tocustomize this liitle instead of writing eamil id in MAIL_LIST , i want to save all the email id names in file mail.txt .
Then i want to send mails to through mailx command to all the names in mail.txt file.


Please help me i think i need to read from mail.txt first and save it in one string and then call that string in mailx ..
Please helpme out ..URGENT ...

Last edited by pludi; 05-10-2010 at 04:57 AM.. Reason: code tags, please...
# 2  
try this
Code:
SUBJECT=path loaction
TO_LIST=someone1@gamil.com,someone2@gamil.com,someone3@gamil.com
echo "[$(date)] [Script Location $(pwd)] " >>  path.lst
mail -s "$SUBJECT"  $TO_LIST < $path.lst


Last edited by pludi; 05-10-2010 at 06:02 AM..
# 3  
hey u didnt got my question... i dont need [TO_LIST=someone1@gamil.com,someone2@gamil.com,someone3@gamil.com ] this to be in my script .
actaully in the same directory i will create afile ex names.txt which will contain all the mail id's .
someone1@gamil.com
someone2@gamil.com
someone3@gamil.com

Now my aim isto read all the names from this file names.txt . Then save it in the string TO_LIST in such a way that all these email id are separated by space . Now we need to call the TO_LIST.
i WANT how to save all these email id in the string .TO_LIST= someone1@gamil.com,someone2@gamil.co...one3@gamil.com
# 4  
try this manisha

Code:
kamaraj@kamaraj-laptop:~/Desktop/testing$ TO_LIST=`cat numbers`
kamaraj@kamaraj-laptop:~/Desktop/testing$ echo $TO_LIST
23423 4234 23 423 423 4 23432 4324 324 234
kamaraj@kamaraj-laptop:~/Desktop/testing$

instead of numbers -- give your email file

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #842
Difficulty: Medium
HTTP server push (also known as HTTP streaming) is a mechanism for sending unsolicited (asynchronous) data from a web server to a web browser.
True or False?

10 More Discussions You Might Find Interesting

1. Red Hat

Problems sending mail: Difference between Mail and Mailx?

Whats the difference between mail and mailx? I'm trying to troubleshoot a problem where I can send mail from server A with this `echo $MESSAGE | mail -s "$SUBJECT" -r $FROM $RECIPIENTS` command but executing the same command from server B throws me this error (Both servers are RHEL) ... (1 Reply)
Discussion started by: RedSpyder
1 Replies

2. Shell Programming and Scripting

Not able to send the mail using mail and mailx command

Hi All, I am trying to send a mail from linux server but could'nt able to send the mail. I tried the below syntax's so far but no luck. mail -s “Hello world” abc@xyz.com < /usr/g/txt.log cat "txt.log" | mailx -s "Hello world" abc@xyz.com mailx -s “Hello world” abc@xyz.com <... (2 Replies)
Discussion started by: scriptscript
2 Replies

3. UNIX for Dummies Questions & Answers

Mailx working but not sending mail

Hi All, I have a unix server on which mailx is configured . Earlier i was getting proper mails but now some mails are getting stuck and i am not receiving the emails from the server. I can see the mails in mailq. Can you please help me with this . How can i receive these emails? (2 Replies)
Discussion started by: pratikm23
2 Replies

4. Shell Programming and Scripting

How to embed a html file in a mail sending from Linux box with uuencode or mailx?

How to embed a html file as subject in a mail sending from Linux box with uuencode or mailx or any other way? we do not want the file as attachment, it should be embedded in the mail subject. (2 Replies)
Discussion started by: johnveslin
2 Replies

5. Shell Programming and Scripting

mailx -s not sending the file to mail address

Hi All, OS:Red Hat Linux 4 86x64 Below is my shell script which is not sending mail to the mail recipient: #!/bin/bash export MAILLIST="xyz@yahoo.com" cd <path_to_the_script_perf_report.sql> sqlplus / as sysdba @perf_report.sql if then cat <path_to_the_script/*MONTHLY*REPORT*.lst... (6 Replies)
Discussion started by: a1_win
6 Replies

6. Shell Programming and Scripting

sending mail using Mailx with data from oracle table

Hi, i need to send emails to the mail ids i receive using the sql query . SELECT L.ALARM_DEF,L.CRITERIA,L.DISTANCE_METRE,L.EMAIL,L.LAC_ID,L.LAST_CHECK,L.RANGE, L.RESOURCE_MSISDN,LM.ADDRESS,LM.NAME FROM LANDMARK_ALARM_CONF l, LANDMARK lm WHERE L.LANDMARK_ID=LM.LANDMARK_ID AND... (0 Replies)
Discussion started by: aemunathan
0 Replies

7. Shell Programming and Scripting

sending mail from perl using mailx

hi All, i am trying to send a mail from perl using mailx. the script runs fine if i hard code the file path which is to be attached to the mail. but when i give a variable containing the path of the file , perl is not able to send the file. ex: system('uuencode /attach/test.txt... (3 Replies)
Discussion started by: adityamahi
3 Replies

8. UNIX for Dummies Questions & Answers

sending mail using mailx command

Hi All, Please help me regarding sending mails using mailx command in unix. I will be glad if some one give me the sintax of this. I tried using the below but vain. mailx -s 'Hi' 'xyz@abc.com' Regards, Manas (5 Replies)
Discussion started by: manas6
5 Replies

9. Shell Programming and Scripting

sending mail through mailx

while trying to send a mail, though the output file doesn't contain any exclamatory mark(!), i am getting that in the mail with an extra line. please help me out from this ASAP. (3 Replies)
Discussion started by: pvamsikr
3 Replies

10. Shell Programming and Scripting

Problem with mailx command when sending attachment.

Hi, I have tried to sent a mail with body and attachment. But the shell script got hanging while executing that command. The command is "(cat body;uuencode att1.csv)|mailx -s "Production Monitoring Report(Unix Side)" milton.yesusundaram@patni.com" where body is a file having a single line.... (2 Replies)
Discussion started by: miltony
2 Replies

Featured Tech Videos