R
R
Ruslan2014-02-20 04:06:21
linux
Ruslan, 2014-02-20 04:06:21

What is a good notification script?

Greetings!
Share a link or script to send notifications.
Task:
There is a file of the form
name @domen .ru 00001
12/21/12 [email protected] 00002 12/22/12
[email protected] 00003 12/23/12
, etc. generated by a script in oracle.
It is necessary to send notifications to the specified addresses in column 1, with the body specified in the second and third columns. The theme may be the same. Your mail server. Number of recipients: several hundred people per day.
I look towards mutt, but so far at the level of reading manuals.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
ZloyHobbit, 2014-02-20
@Pumko_adm

We take something like mailutils (just the first thing that came across to send letters from the script) and write something like:

#!/bin/bash
cat $1 | while read line
do
  MAIL=${line%% *} #отрезаем от строки line все что после первого пробела включительно
  BODY=${line#* } #отрезаем все, что до первого пробела включительно
  echo $BODY | mail $MAIL
done

With the help of BASG , you can complicate the script by adding the subject of the message, the sender's address, etc. And, accordingly, it is more difficult to shred the lines.
Oh yes, the script is saved in script.sh, and run as:
Where filename is the name of the file with emails and messages

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question