<<< Date Index >>>     <<< Thread Index >>>

Re: multiple mail sending with bash script



Moin, foreword: this belongs to mutt-users rather than mutt-dev.
Please follow-up there.

=- alexbo@xxxxxxxxxx wrote on Sat 12.Jan'08 at  9:21:06 +0100 -=

> I've tried to comply this using a ASCII text file named "test.txt"
> having one row per recipient in the format
> {...}
> and a bash script named "test" like this:
> 
> !#/bin/sh
> FILE="test.txt"
> while read line; do
>     `$line`
> done < $FILE
> 
> When running the "test" script, it ends very early with no
> warnings: only the first message is dispatched, the others are
> ignored at all.

a) mutt reads "body" from STDIN, which reads from the same as "for",
till EOF, nothing left for "for" and succeeding "mutt"s.

> Another trial was a text file named "test2.txt" having one row per
> recipient in the format
> subject(N)^name_file_to_attach(N)^recipient_address(N)
> 
> and a new bash script named test2 like this:
> 
> #!/bin/sh
> FILE="test2.txt"
> FS="^"
> while read line
> do
>     F1=$(echo $line|cut -d$FS -f1)
>     F2=$(echo $line|cut -d$FS -f2)
>     F3=$(echo $line|cut -d$FS -f3)
>     /usr/bin/mutt -s " " $F1 -i " " [body file text to include] -a " " $F2 " 
> " $F3
> done < $FILE
> 
> When running "test2" I have various errors but to cut short a long story it 
> doesn't work.
> My experience lacks for sure: is there anyone here who can help me ?

b) same problem as before.

Must give "mutt" its own STDIN.

-- 
© Rado S. -- You must provide YOUR effort for your goal!
EVERY effort counts: at least to show your attitude.
You're responsible for ALL you do: you get what you give.