[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
sending mail: starttls and gnutls-cli sessions
From: |
Marco Maggi |
Subject: |
sending mail: starttls and gnutls-cli sessions |
Date: |
Mon, 27 Apr 2009 12:27:06 +0200 |
Ciao,
I want to send email through two remote servers, Gmail and
Poste.it, using gnutls-cli for authentication. I am on a
GNU+Linux system running Emacs 22.3.1 from the latest stable
Slackware package.
I can successfully send mail through Gmail both using Gnus
and using an interactive eshell session in which I run
gnutls-cli directly and write SMTP commands by hand. Fine,
I know that it can work.
When running the eshell session for Gmail, I do this: in
the eshell buffer
$ gnutls-cli --crlf --starttls --port 587 smtp.gmail.com
and the server replies with a line of greetings; so I start
an SMTP dialogue and issue the STARTTLS SMTP command; now on
a xterm I send a SIGALRM signal to the running gnutls-cli
process, and it establishes the encrypted bridge. Then
everything works. I assume that this is what Gnus does
using the underlying libraries.
Now with Poste.it I can do the same on an eshell session,
but I have to leave out the "--starttls" option:
$ gnutls-cli --crlf --port 465 relay.poste.it
because the server wants the encrypted bridge set up
immediately. Alternatively I can start gnutls-cli with
"--starttls" and immediately send a SIGALRM to the process,
without waiting for server's greetings.
Reading the documentation of Gnus and Smtpmail I cannot
find a way to select command line parameters for gnutls-cli
or to tell it to send SIGALRM immediately without messing
with undocumented internal state of the libraries.
I see in "starttls.el" that a relevant function is be
`starttls-open-stream-gnutls'. In the form:
(apply #'start-process name buffer
starttls-gnutls-program "-s" host
"-p" (if (integerp port) (int-to-string port) port)
starttls-extra-arguments)
it makes use of the "-s" option, which is short for
"--starttls". So the way to go is to send SIGALRM
immediately. Then the form:
(while (and (processp process)
(eq (process-status process) 'run)
(save-excursion
(set-buffer buffer)
(goto-char old-max)
(not (setq done (re-search-forward
starttls-connect nil t)))))
(accept-process-output process 0 100)
(sit-for 0.1))
waits for gnutls-cli text telling that the connection was
established ("Simple Client Mode"); fine this is should be
read correctly because I see it in the interactive session.
So I have to turn to "smtpmail.el", which is BIG! Here I
guess that the problem is in `smtpmail-via-smtp', which
seems to always try to send a EHLO command before
considering a call to `starttls-negotiate'.
My problem is that when `smtpmail-via-smtp' does:
(setq greeting (smtpmail-read-response process))
Gnus blocks waiting for input that will never arrive, until
I stop it with C-g.
What to do? Do I have to send a feature request to
someone?
-- Marco Maggi
- sending mail: starttls and gnutls-cli sessions,
Marco Maggi <=