Problem with mhmail

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem with mhmail

Norman Shapiro-3
When I do:

  echo hello norm|mhmail -to norm\@dad.org -subject 'Fetch Errors' -snoop

I get:

Trying to connect to "localhost" ...
Connecting to ::1:587...
Connection failed: Connection refused
Connecting to 127.0.0.1:587...
Connection failed: Connection refused
post: problem initializing server; [BHST] no servers available (use -snoop for details
Letter saved in dead.letter

mhmail -version gets:

mhmail -- nmh-1.7.1 built 2018-03-17 14:13:11 +0000 on nad.dad.org

I will attach ~/.mh_profile and dead.letter.

    Norman Shapiro

dead.letter (75 bytes) Download Attachment
.mh_profile (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Problem with mhmail

David Levine-3
Norm writes:

> When I do:
>
>   echo hello norm|mhmail -to norm\@dad.org -subject 'Fetch Errors' -snoop

How about this:

    echo hello norm|mhmail -to norm\@dad.org -subject 'Fetch Errors' -snoop \
    -profile -sasl -tls -server smtp.gmail.com

If that doesn't succeed, add the following to it:

    -user [hidden email]

David

Reply | Threaded
Open this post in threaded view
|

Re: Problem with mhmail

David Levine-3
I wrote:

> How about this:
>
>     echo hello norm|mhmail -to norm\@dad.org -subject 'Fetch Errors' -snoop \
>     -profile -sasl -tls -server smtp.gmail.com

Just adding -profile should be sufficient, because the other additions are
in the send component value of your profile.  So,

    echo hello norm|mhmail -to norm\@dad.org -subject 'Fetch Errors' -snoop -profile

David

Reply | Threaded
Open this post in threaded view
|

Re: Problem with mhmail

Norman Shapiro-3
David Levine <[hidden email]> writes:

>I wrote:
>
>> How about this:
>>
>>     echo hello norm|mhmail -to norm\@dad.org -subject 'Fetch Errors' -snoop \
>>     -profile -sasl -tls -server smtp.gmail.com
>
>Just adding -profile should be sufficient, because the other additions are
>in the send component value of your profile.  So,
>
>echo hello norm|mhmail -to norm\@dad.org -subject 'Fetch Errors' -snoop -profile

Thank you very much. But I've decided that I am no longer smart enough to
master the intricacies of mhmail.

Instead, I wrote and will use a trivial script, I call "mymail":

-------------------
set -eu

if test $# -ne 1
then
  echo >&2 bad arg count
  exit 1
fi

folder=+$(mhparam Draft-folder)
draft=$(mhpath new $folder)
echo "To: [hidden email]" >> $draft
echo "From: [hidden email]" >> $draft
echo "Send: x" >> $draft
echo "Subject: $1" >> $draft
echo ______ >> $draft
cat >> $draft


msg=$(basename  $draft)
send $msg
-------------------

    Norman Shapiro


Reply | Threaded
Open this post in threaded view
|

Re: Problem with mhmail

Ralph Corderoy
Hi Norm,

> Thank you very much. But I've decided that I am no longer smart enough
> to master the intricacies of mhmail.

You're still happy with comp(1) and repl(1) for more complex
requirements?

> msg=$(basename  $draft)
> send $msg

I think you want just

    send $draft

there because send wants a path, not a message number.

--
Cheers, Ralph.

Reply | Threaded
Open this post in threaded view
|

Re: Problem with mhmail

Ralph Corderoy
Hi Norm,

Copying back in [hidden email] because it's of wider interest.

> > I think you want just
> >
> >     send $draft
> >
> > there because send wants a path, not a message number.
>
> The use of the word, "file", in the documentation would certainly
> imply that.  But, in fact, send wants message numbers.

That confused me so I dug further.

send(1) says ‘file ...’ in the Synopsis but doesn't explain that the
-draftfolder option changes the meaning of those file arguments to
messages.

So ‘send foo’ wants a file called foo to exist in ‘mhpath path’.

    $ send foo
    send: unable to stat draft file /home/ralph/mail/foo: No such file or directory

An absolute path is used absolutely.

    $ send /tmp/foo
    send: unable to stat draft file /tmp/foo: No such file or directory

A relative path still has ‘mhpath path’ prepended.

    $ send tmp/foo
    send: unable to stat draft file /home/ralph/mail/tmp/foo: No such file or directory

A filename that happens to be a number doesn't affect this behaviour.

    $ send 42
    send: unable to stat draft file /home/ralph/mail/42: No such file or directory

It's using -draftfolder that changes the arguments from files to message
numbers.

    $ send -draftfolder drafts 314
    send: message 314 doesn't exist
    $ send -draftfolder drafts last
    $

That's despite my .mh_profile stating a general draft folder.

    $ mhparam draft-folder
    drafts

send(1) doesn't explain this.  It makes a reference to mh-draft(5), but
it isn't obvious to read that for this behaviour of send.  By its name
and section, mh-draft(5) should only be describing the file format of
draft emails; something needed by Arthur recently when confused about
comp(1)'s -to description.

    The -draftfolder +folder and -draftmessage msg switches invoke the
    nmh draft folder facility.  This is an advanced (and highly useful)
    feature.  Consult mh-draft(5) for more information.

Thus if your script works with specifying a message number then it
suggests your .mh_profile has ‘send: -draftfolder’ or similar.

By my reading of the documentation, this should break ‘send’ at the
whatnow(1) prompt because that will pass a filename but it will attempt
to be interpreted as a message.  That it works is probably because
whatnow spots the command is send and calls a function to implement it
rather than forking and execing the read send.  I think this is another
wrong approach.  Perhaps useful when a fork/exec in response to an
interactive request was costly, but not now when it only allows for
confusion due to varying behaviour behind the scenes.

--
Cheers, Ralph.