[opensuse] Metasend
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 didn't exactly know how to use the script so I wrote back to seek some clarification, and of course my attempt to figure it out was wrong. The response I got was less than helpful, and I am still left in the dark as to how to use the script. So I thought that it would be more profitable to seek advice here on the list regarding how to use this list. 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. 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@jpmussels.com Abernathy Cool suzytalker@roadrunner.net Suzy Talker jonathantrakes@scommand.com 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. SUBJECT - Just replace this with something like "Monthly Newsletter" FROM - replace this with my email address TEXTFILE - Not sure what this one is for, unless it is something to appear in the body of the email, like: This is your monthly newsletter! PDFFILE - Not sure what to do with this one, I think I have to insert the whole pdf file of the newsletter here but am not sure how to do that. Well, as you can probably tell from my questions, I haven't caught on to this yet. So I hope that your answers will be simple and explanatory. Thanks, Mark -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
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@jpmussels.com Abernathy Cool
suzytalker@roadrunner.net Suzy Talker
jonathantrakes@scommand.com 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@your.isp.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@iinet.net.au =================================================== -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Rodney Baker said the following on 11/05/2011 10:31 AM:
What you have is a fragment of a script - this is not a complete shell script.
I told him that when I sent it to him bask on 10/16/2001
I'd suggest you read a) the metasend man page, to understand what the above fragment is doing,
I suggested that to him as well. Man pages are an important part of comprehension. If you don't read and understand them you are unlikely to understand how to use the command.
and b) a tuturial on shell scripting for your preferred shell (be it bash, zsh, csh or whatever)
And I suggested that as well.
I don't think that I can point to the file from within the script,
You can, I showed him how.
as if the mail list file was stored on the computer in a different file.
I told him that as well, I even suggested the format, address followed by names I explained that the above was the 'inner loop' and that he needed something external to it that did: cat addressfile | while read DEST REALNAME do ...
The ${XXXX} are names of variables that you have to define at the beginning of the script. For example:
I told home that too, and explained and illustrated just as you have done but rather more ...
DEST="some-recipient@some-server.domain" SUBJECT="Monthly Newsletter" FROM="you@your.isp.domain" TEXTFILE="/path/to/textfile" PDFFILE="/path/to/pdffile"
Actually I suggested ------------------------------ #! /bin/sh cd $HOME/SkiMailManagement ADDRESSFILE=${ADDRESSFILE-skipatrolemailaddresslist} SUBJECT=${SUBJECT-"Newsletter for $(date %B %Y)"} FROM=${FROM-"munguanaweza@embarqmail.com"} TEXTFILE=${TEXTFILE-./newsletters/$(date %Y/%b).txt} PDFFILE=${PDFFILE-./newsletters/$(date %Y/%b).pdf} You can see that there are few assumptions. First, that this is a directory of its own where the address list and other stuff live. Second that there is a subdirectory with the newsletters. Third, that they are "by month". Fourth that they are available both as text and PDF. OOPS! Not everyone does that, eh? So the TEXTFILE should be set to a plain text file that says "Please see the attached PDF file". Having things set like this with the shell variables allows for this flexibility.
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.
That depends on whether you see the fragment as being all of the script or having the 'while' in the script. The lists I maintain this for it is inside the script.
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.
I think his real problem is that he doesn't get shell scripting and variables. Once upon a time UNIX ran in less than 56K so there was more reliance on scripts as opposed to binaries. That's where I leant, machines that had lots and lots of scripts to do what we do with binaries these days. Much more 'visibility'. I also suggested he read http://www.shelldorado.com/scripts/cmds/sendfile which is a much simpler but well scripted example of using metasend. -- People who make no mistakes do not usually make anything. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 11/5/2011 3:02 PM, Anton Aylward wrote:
Rodney Baker said the following on 11/05/2011 10:31 AM:
What you have is a fragment of a script - this is not a complete shell script.
I told him that when I sent it to him bask on 10/16/2001
I'd suggest you read a) the metasend man page, to understand what the above fragment is doing,
I suggested that to him as well. Man pages are an important part of comprehension. If you don't read and understand them you are unlikely to understand how to use the command.
and b) a tuturial on shell scripting for your preferred shell (be it bash, zsh, csh or whatever)
And I suggested that as well.
I don't think that I can point to the file from within the script,
You can, I showed him how.
as if the mail list file was stored on the computer in a different file.
I told him that as well, I even suggested the format, address followed by names
I explained that the above was the 'inner loop' and that he needed something external to it that did:
cat addressfile | while read DEST REALNAME do ...
The ${XXXX} are names of variables that you have to define at the beginning of the script. For example:
I told home that too, and explained and illustrated just as you have done but rather more ...
DEST="some-recipient@some-server.domain" SUBJECT="Monthly Newsletter" FROM="you@your.isp.domain" TEXTFILE="/path/to/textfile" PDFFILE="/path/to/pdffile"
Actually I suggested
------------------------------ #! /bin/sh
cd $HOME/SkiMailManagement
ADDRESSFILE=${ADDRESSFILE-skipatrolemailaddresslist} SUBJECT=${SUBJECT-"Newsletter for $(date %B %Y)"} FROM=${FROM-"munguanaweza@embarqmail.com"}
TEXTFILE=${TEXTFILE-./newsletters/$(date %Y/%b).txt} PDFFILE=${PDFFILE-./newsletters/$(date %Y/%b).pdf}
You can see that there are few assumptions. First, that this is a directory of its own where the address list and other stuff live. Second that there is a subdirectory with the newsletters. Third, that they are "by month". Fourth that they are available both as text and PDF.
OOPS! Not everyone does that, eh? So the TEXTFILE should be set to a plain text file that says "Please see the attached PDF file".
Having things set like this with the shell variables allows for this flexibility.
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.
That depends on whether you see the fragment as being all of the script or having the 'while' in the script.
The lists I maintain this for it is inside the script.
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.
I think his real problem is that he doesn't get shell scripting and variables.
Once upon a time UNIX ran in less than 56K so there was more reliance on scripts as opposed to binaries. That's where I leant, machines that had lots and lots of scripts to do what we do with binaries these days. Much more 'visibility'.
I also suggested he read http://www.shelldorado.com/scripts/cmds/sendfile which is a much simpler but well scripted example of using metasend.
I wish I'd read this before I went and spent all the time writing my last post! headsmak. -- bkw -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Sun, 2011-11-06 at 22:01 -0500, Brian K. White wrote:
I wish I'd read this before I went and spent all the time writing my last post! headsmak.
-- bkw
Hi, thanks for taking the time to write your reply, the info is very helpful to me. Mark -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Sun, 2011-11-06 at 01:01 +1030, Rodney Baker wrote:
On Sat, 5 Nov 2011 23:59:16 Mark Misulich wrote:
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).
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@your.isp.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@iinet.net.au ===================================================
Hi, thanks for the helpful reply. I can't make any pretense about knowing anything about shell scripting, but this got me pointed in the right direction to learn it. Mark -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 11/5/2011 9:29 AM, 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 didn't exactly know how to use the script so I wrote back to seek some clarification, and of course my attempt to figure it out was wrong. The response I got was less than helpful, and I am still left in the dark as to how to use the script. So I thought that it would be more profitable to seek advice here on the list regarding how to use this list.
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.
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@jpmussels.com Abernathy Cool
suzytalker@roadrunner.net Suzy Talker
jonathantrakes@scommand.com 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.
SUBJECT - Just replace this with something like "Monthly Newsletter"
FROM - replace this with my email address
TEXTFILE - Not sure what this one is for, unless it is something to appear in the body of the email, like: This is your monthly newsletter!
PDFFILE - Not sure what to do with this one, I think I have to insert the whole pdf file of the newsletter here but am not sure how to do that.
Well, as you can probably tell from my questions, I haven't caught on to this yet. So I hope that your answers will be simple and explanatory.
Thanks, Mark
You have it pretty close.
Create a file with the email addresses and associated human-readable names.
Use this format:
Brian K. White
participants (4)
-
Anton Aylward
-
Brian K. White
-
Mark Misulich
-
Rodney Baker