Re: [Nmh-workers] Sending "automatic" email

2008-04-24 Thread David Levine
> > Are you looking for this:
> > 
> >   $ mhmail  ... -subject  -body 
> > 
> 
> Exactly.
> 
> Subsidiary question: if the body consist of something like:
> 
> #application/octet-stream  
> 
> Will it work as is or do I need to do extra stuff such as MIMEifing the 
> message ?

I don't believe that will work, you will have to MIMEify the
message.  It might be possible to put the body into a temporary
file, run mhbuild on it, and then feed it to the standard input
of mhmail.  (You would not need the -body option in that case.)

David

__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__


___
Nmh-workers mailing list
Nmh-workers@nongnu.org
http://lists.nongnu.org/mailman/listinfo/nmh-workers


Re: [Nmh-workers] Sending "automatic" email

2008-04-23 Thread Xavier Maillard
> Are you looking for this:
> 
>   $ mhmail  ... -subject  -body 
> 

Exactly.

Subsidiary question: if the body consist of something like:

#application/octet-stream  

Will it work as is or do I need to do extra stuff such as MIMEifing the message 
?


Regards


Xavier


___
Nmh-workers mailing list
Nmh-workers@nongnu.org
http://lists.nongnu.org/mailman/listinfo/nmh-workers


Re: [Nmh-workers] Sending "automatic" email

2008-04-23 Thread Xavier Maillard
> Xavier Maillard <[EMAIL PROTECTED]> wrote on Apr 23, 2008:
> 
> >I am trying to figure out how, given the To, Subject and body of message, to 
> >generate a complete mail 
> draft ready to shoot.
> 
> I'm not quite sure what you are want.  But here is a shell script,
> shamelessly stolen from somewhere forgotten, and modified for my
> use.  It probably isn't what you want, but might be something you
> can modify to do what you want.

Thank you for the script but the closest solution was David's one.


Regards,

Xavier


___
Nmh-workers mailing list
Nmh-workers@nongnu.org
http://lists.nongnu.org/mailman/listinfo/nmh-workers


Re: [Nmh-workers] Sending "automatic" email

2008-04-23 Thread David Levine
Are you looking for this:

  $ mhmail  ... -subject  -body 

David


Xavier writes:

> I am trying to figure out how, given the To, Subject and body of message, to 
> generate
> a complete mail draft ready to shoot.
> 
> I read about sendfile, comp and friends *but* I can't give these
> information at the command line level.
> 
> How do you generally do ?

__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__


___
Nmh-workers mailing list
Nmh-workers@nongnu.org
http://lists.nongnu.org/mailman/listinfo/nmh-workers


Re: [Nmh-workers] Sending "automatic" email

2008-04-23 Thread Neil W Rickert
Xavier Maillard <[EMAIL PROTECTED]> wrote on Apr 23, 2008:

>I am trying to figure out how, given the To, Subject and body of message, to 
>generate a complete mail draft ready to shoot.

I'm not quite sure what you are want.  But here is a shell script,
shamelessly stolen from somewhere forgotten, and modified for my
use.  It probably isn't what you want, but might be something you
can modify to do what you want.

 -NWR
  - cut here -
#!/bin/sh

# System dependencies

defeditor=/usr/bin/vi

istty=no
if test -t 0; then istty=yes ; fi

dotdir=${DOTDIR-${HOME-$LOGDIR}}
MHDIR=`mhpath +` 2>/dev/null
if [ $? != 0 ] ; then
  echo "MH does not appear to be available or initialized" >&2
  exit 1
fi

fcc="+outbox"

subject=
cc=
bcc=
to=

while :
do
case $# in
0) break ;;
esac

case "$1" in
"-s") subject="$2" ; shift ;;
"-c") case "$cc" in
"") cc="$2" ;;
*)  cc="$cc, $2" ;;
  esac
  shift
  ;;
"-b") case "$bcc" in
"") bcc="$2" ;;
*)  bcc="$bcc, $2" ;;
  esac
  shift
  ;;
"-d") case "$dcc" in
"") dcc="$2" ;;
*)  dcc="$dcc, $2" ;;
  esac
  shift
  ;;
"-t") case "$to" in
"") to="$2" ;;
*)  to="$to, $2" ;;
  esac
  shift
  ;;
"-f") case "$2" in
+*) x=`mhpath "$2"` ;;
*)  x=`mhpath "+$2"` ;;
  esac
  if [ -d "$x" ] ; then
fcc="$2"
  else
echo "folder $2 : not found" >&2
exit 1
  fi
  shift
  ;;
*)case "$to" in
"") to="$1" ;;
*)  to="$to, $1" ;;
  esac
  ;;
esac
shift
done

case "$to" in
"") echo "xmail: No 'To:' recipients" 1>&2
exit 1
;;
esac

draftfile=`mhpath +drafts new`

echo "To: $to" > $draftfile
case "$cc" in
"") ;;
*) echo "Cc: $cc" >> $draftfile ;;
esac

case "$dcc" in
"") ;;
*) echo "Dcc: $dcc" >> $draftfile ;;
esac

case "$bcc" in
"") ;;
*) echo "Bcc: $bcc" >> $draftfile ;;
esac

case "$subject" in
"") ;;
*) echo "Subject: $subject" >> $draftfile ;;
esac

echo "Fcc: $fcc" >> $draftfile
echo "" >> $draftfile

case "$istty" in
"no") SIZE="`wc -c < $draftfile`"
  cat >> $draftfile
  case "`wc -c < $draftfile`" in
"$SIZE") echo "Empty message not sent" 1>&2
 rm -f $draftfile
 exit 1
 ;;
  esac
  exec send -push $draftfile
  ;;
esac

echo "" >> $draftfile
echo " -NWR" >> $draftfile
exec comp -use -editor ${VISUAL-${EDITOR-$defeditor}} -draftf +drafts -draftm 
last

  - cut here -


___
Nmh-workers mailing list
Nmh-workers@nongnu.org
http://lists.nongnu.org/mailman/listinfo/nmh-workers


[Nmh-workers] Sending "automatic" email

2008-04-23 Thread Xavier Maillard

Hi,

I am trying to figure out how, given the To, Subject and body of message, to 
generate a complete mail draft ready to shoot.

I read about sendfile, comp and friends *but* I can't give these information at 
the command line level.

How do you generally do ?

Regards

Xavier

-- 
Xavier Maillard


___
Nmh-workers mailing list
Nmh-workers@nongnu.org
http://lists.nongnu.org/mailman/listinfo/nmh-workers