Automating Mail Process


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Automating Mail Process
# 22  
Old 08-02-2016
Please change the script to:
Code:
#!/bin/bash
ATTACHMENT_DIR="/home/sreenivasa/Desktop/ATTACH"
ATTACHMENTS=
BODY_FILE="/home/sreenivasa/Desktop/Testing.txt"
SUBJECT="linux mail send attachment example"
TO_LIST="rajnikant875@gmail.com,sinha6315@gmail.com,rajnikant@gytechs.com"

# Gather list of attachments:
for file in "$ATTACHMENT_DIR"/*
do	[ ! -f "$file" ] && continue
	ATTACHMENTS="$ATTACHMENTS -a $file"
done

# Send the message.
mail -s "$SUBJECT"  $ATTACHMENTS "$TO_LIST" < "$BODY_FILE"

and try again.
# 23  
Old 08-03-2016
Automating Mail Process

hi sir
this code is working fine.one more request can script read the CC_LIST email id from some text files which is located on Desktop instead of directly specifying in the script.

thanks
Rajnikant
# 24  
Old 08-03-2016
Quote:
Originally Posted by rajnikant
hi sir
this code is working fine.one more request can script read the CC_LIST email id from some text files which is located on Desktop instead of directly specifying in the script.

thanks
Rajnikant
Hi jajnikant,
We are here to help you learn how to write scripts on your own; not to act as your unpaid programming staff.

Of course a shell script can read data from a file and save that value in a variable. (But, as noted before, your mail command is not sending any messages to a carbon copy list; only to a distribution list. Do you want to start sending your message to a carbon copy list as well as the distribution list that is current built-in to your script, or do you just want to read the distribution list from a file?) Look at the man page for your shell on your system (try man bash) in the SHELL BUILT-IN COMMANDS section for the description of the "read" built-in utility to see if you can make that do what you want. If you can't, show us what you have tried and we'll help you fix it.

- Don
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Automating an interactive process with EOF string

Hello, I'm running Stockfish chess engine ( Home - Stockfish - Open Source Chess Engine ) CLI on Linux in interactive mode which is working fine. root@ubuntu1950x:~# ./stockfish Stockfish 080218 64 POPCNT by T. Romstad, M. Costalba, J. Kiiski, G. Linscott setoption name Debug Log File... (2 Replies)
Discussion started by: prvnrk
2 Replies

2. UNIX for Dummies Questions & Answers

Automating a process

Could any one tell me , how to start a thread here, i just searching for so long. sorry to post in irrelavent here ---------- Post updated at 08:19 AM ---------- Previous update was at 08:00 AM ---------- Hi, I got a requirement to automate the process. We have SLA files, there are... (1 Reply)
Discussion started by: afahmed
1 Replies

3. Shell Programming and Scripting

Automating The process

Hi Guru's, I am trying to write a scripts that will automate my image provisoining process. Scenario: I have Linux Image Hosted on cloud which needs to be provisoned before it can be used. Currently we log onto the image through the putty on windows and connect to linux instance. I... (3 Replies)
Discussion started by: taqvia
3 Replies

4. Shell Programming and Scripting

automating daily monitoring process

Hi there, I have to automate daily monitoring process and then the result of these process should be sent to a log file, then this log file should be mailed . ps -ef | grep aa In this atleast one process should run. If the process is running it should mention Success in the log file... (3 Replies)
Discussion started by: NehaKrish
3 Replies

5. Shell Programming and Scripting

script to monitor process running on server and posting a mail if any process is dead

Hello all, I would be happy if any one could help me with a shell script that would determine all the processes running on a Unix server and post a mail if any of the process is not running or aborted. Thanks in advance Regards, pradeep kulkarni. :mad: (13 Replies)
Discussion started by: pradeepmacha
13 Replies

6. Shell Programming and Scripting

Issue in mail sending process

Hi I created one CSV file and i need to append some message in the content of my mail. $sales=sales.dat $sales_csv=sales.csv $sales_report=sales.txt this is the command am using it. echo "sales for `date`"| read subject uuencode $sales $sales_csv | mailx -ms "${subject}."... (2 Replies)
Discussion started by: bobprabhu
2 Replies

7. Shell Programming and Scripting

Killing of a process and send a mail if the process doesnot come up within 2 minutes

Hi Friends, I am new to this forum as well as new to shell scripting. I have a problem here and i need someone to solve this. Let us consider there are two processes(abc & def).There is a script which kills these two processes(i.e killtheprocess abc). Here abc is the argument . There is a... (1 Reply)
Discussion started by: Prince89
1 Replies

8. Linux

Automating build and test process

Hey ppl, I've been asked to automate the build and test process for my team at office.we work on Linux and use Perforce for SCM. I've just joined this company and dont have much knowledge on unix scripts. Could someone tell me how to go about doing this?:confused: (8 Replies)
Discussion started by: laxmi
8 Replies

9. Shell Programming and Scripting

Automating build and test process

Hey ppl, I've been asked to automate the build and test process for my team at office.we work on Linux and use Perforce for SCM. I've just joined this company and dont have much knowledge on unix scripts. Could someone tell me how to go about doing this? (0 Replies)
Discussion started by: laxmi
0 Replies

10. UNIX for Dummies Questions & Answers

Process mail using cron

I am looking for information on how to process mail using a cron job. The email server is a hosted ISP, so I simply have a POP connection to the mailbox. Specifically, I want to fire a cron job at {x} time and have pine, mail, mailx, or some other suitable mail client utility process the... (1 Reply)
Discussion started by: EOD
1 Replies
Login or Register to Ask a Question