Mailinglist Archive: opensuse (1690 mails)

< Previous Next >
Re: [opensuse] Metasend
On Sat, 5 Nov 2011 23:59:16 Mark Misulich wrote:
Hi,
a couple of weeks ago I posted asking for some help with a spurious
email that I was receiving when I sent out emails to a group for which I
write a newsletter.

One of the members of the list was kind enough to respond off list and
send me a metasend script that he uses, recommending to use it instead
of my current method of mailing. Here is the script:

metasend -b -e 7bit -t $DEST \
-s $SUBJECT \
-F $FROM \
-m "text/plain" -f $TEXTFILE \
-n \
-S 10000000 \
-m "application/pdf;name=\"${PDFFILE}\"" \
-f ${PDFFILE} \
-D ${PDFFILE}
sleep 5
done


[...]
I think that in place of each of the capitalized parts of the script I
need to insert something, so here is my best guess and I hope that the
list members will correct me.

What you have is a fragment of a script - this is not a complete shell script.
I'd suggest you read a) the metasend man page, to understand what the above
fragment is doing, and b) a tuturial on shell scripting for your preferred
shell (be it bash, zsh, csh or whatever) or get to know something like python
or ruby (either of which I'm pretty sure could handle this easily).


DEST - I think that I have to make up and insert a file into the script
with each of the email addresses of the mail list members, like

abernathycool@xxxxxxxxxxxxx Abernathy Cool

suzytalker@xxxxxxxxxxxxxx Suzy Talker

jonathantrakes@xxxxxxxxxxxx Jonathan Trakes

I don't think that I can point to the file from within the script, as if
the mail list file was stored on the computer in a different file. I
think that it has to be a part of the script.

The ${XXXX} are names of variables that you have to define at the beginning of
the script. For example:

DEST="some-recipient@some-server.domain"
SUBJECT="Monthly Newsletter"
FROM="you@xxxxxxxx.domain"
TEXTFILE="/path/to/textfile"
PDFFILE="/path/to/pdffile"

You could hard code these in the script, or you could pass them as command-
line parameters. I suggest you consult a tutorial on scripting for your
specific shell (bash, csh, zsh etc.) to see how to do this.

This of course assumes that the script is being called once for each email
address on the list. An easier way would be to source a file with a list of
all the email addresses, then parse that file one line at a time in a
conditional loop until you reach EOF, updating DEST and re-running the above
fragment until the last email has been sent.

Shell scripting isn't that hard once you've played with it a few times. There
are plenty of good online resources that google will turn up for you but some
are better than others - YMMV.

HTH,
Rodney.


--
===================================================
Rodney Baker VK5ZTV
rodney.baker@xxxxxxxxxxxx
===================================================

--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse+owner@xxxxxxxxxxxx

< Previous Next >
References