 nixenRockin' the BoxenPremium join:2002-10-04 Alexandria, VA | reply to DprssdIsntFn
Re: 'find' and 'sendmail' Umm... are these queue files or regular text files you're looking to mail. If the former, why not simply invoke sendmail with the QueueDirectory option and the "run queue now" option? -- Everyday, thousands of new cars are delivered to their new owners with poorly-selected radio station presets. |
|
 Reviews:
·Bright House
| Thanx for the responses so far. To answer some of the questions:
These are regular files.
Here are some sample attempts and corresponding results:
1} This example works:
test.em
#!/bin/sh
sendmail -t <emails/new/test4
exit
result:
# ./test.em
#
None of the following example(s) work. What you see here are different combinations of different things I've tried. i.e. one from column A, one from column B ...
The results below are typical.
automaild
#!/bin/sh
#
# Create the list of emails to be processed
#
echo 'create list of emails'
find emails/new/ -type f -print > email.list
cat email.list
echo ' '
#
# Create the arguments to be processed by sendmail
#
echo 'create sendmail arguments'
sed 's/ema/\<ema/' email.list > email.send
#sed 's/ema/\sendmail -t <ema/' email.list > email.send
cat email.send
echo ' '
#
# Send the email
#
echo 'send email'
#cat email.send | xargs -p -l sendmail -t
cat email.send | ( xargs -p -l sendmail -t )
#cat email.send | xargs -p -l
#cat email.send | exec {} \;
echo ' '
#
# Create the arguments to be processed by mv
#
echo 'create mv arguments'
sed 's/\([^ ][^ ]*\)/\1 \1/' email.list > email.temp1
echo ' '
sed 's/new/sent/g' email.temp1 > email.temp2
echo ' '
sed 's/sent/new/' email.temp2 > email.mv
cat email.mv
echo ' '
#
# Move the email to the sent directory
#
#cat email.mv | xargs -l mv
Results part 1. Here, I've not answered 'y' to the 'xarg' prompts. This is just to show that the command to be executed is properly formed as in the working example above.
# ./automaild
create list of emails
emails/new/test1
emails/new/test2
emails/new/test3
emails/new/test4
create sendmail arguments
sendmail -t <emails/new/test1
sendmail -t <emails/new/test2
sendmail -t <emails/new/test3
sendmail -t <emails/new/test4
send email
sendmail -t <emails/new/test1 ?...
sendmail -t <emails/new/test2 ?...
sendmail -t <emails/new/test3 ?...
sendmail -t <emails/new/test4 ?...
create mv arguments
emails/new/test1 emails/sent/test1
emails/new/test2 emails/sent/test2
emails/new/test3 emails/sent/test3
emails/new/test4 emails/sent/test4
#
This is a snip of actual results.
send email
sendmail -t <emails/new/test1 ?...y
<emails/new/test1... Unbalanced '<'
<emails/new/test1... User unknown
Saving message in dead.letter
dead.letter: line 0: <emails/new/test1... Unbalanced '<'
dead.letter: line 0: <emails/new/test1... Unbalanced '<'
The problem I had with the automatic insertion of the space between '' and 'email/file' I got around through the use of sed and temporary files.
If I execute the sendmail command directly in a script, it works fine. If I attempt to use either 'exec' or 'xargs', it fails.
This version of the DG-UX OS was last updated in 1998. This box was installed in 1994. I really, really don't like working with antique OSes!
Ugh!
Any more thoughts or ideas? |
|
 nixenRockin' the BoxenPremium join:2002-10-04 Alexandria, VA | Why not use mailx instead of trying to figure out sendmail? |
|
 Reviews:
·Bright House
| said by nixen:Why not use mailx instead of trying to figure out sendmail? I actually started out with mail(x). On this system, mail(x) calls sendmail to send mail. I got absolutely nowhere with it.
The problem isn't with sendmail. It's with this version of 'sh'. I've finally tracked the problem down to how 'xarg' and 'exec' are parsed from within a 'sh' script. The parsing is not correct when redirection of a file to standard input is involved. For most cases, the parsing works fine. Just not in this case.
I'm taking a different approach entirely. Instead of writing just emails to a directory, I'm also writing short, 3-line 'sh' scripts to another directory. Then I select that directory and execute the scripts there.
Fortunately, this is a relatively low volume application. |
|