help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

problem using .authinfo.gpg with smtpmail


From: Tom Roche
Subject: problem using .authinfo.gpg with smtpmail
Date: Wed, 17 Aug 2011 12:21:06 -0400
User-agent: GNU Emacs 23.3.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.4)

summary: I believe I am properly configured to use .authinfo.gpg with
sendmail.el. However, when I try to send mail, I get the usual messages,
followed by 2 requests for passphrase, followed by failure:

> (error "Sending failed; SMTP protocol error")

I also observe a problem reading .authinfo.gpg from emacs (details
below), though it looks fine in bash. How to fix?

details:

Vijay Lakshminarayanan Wed, 17 Aug 2011 09:07:05 +0530
> As long as you have gnupg in your PATH,

Just for the benefit of the next literal-minded newbie:

me@it:~$ which gnupg
# `C-h i`, then
me@it:~$ which gpg
/usr/bin/gpg
me@it:~$ gpg --version
gpg (GnuPG) 1.4.11

I also have

me@it:~$ lsb_release -ds
Linux Mint Debian Edition
me@it:~$ uname -rv
2.6.39-2-amd64 #1 SMP Tue Jul 5 02:51:22 UTC 2011
me@it:~$ emacs --version
GNU Emacs 23.3.1

init.el
> (if (>= emacs-major-version 23)
>   (progn
>     (require 'auth-source)
>     (if (file-exists-p "~/.authinfo.gpg")
>       (setq auth-sources '((:source "~/.authinfo.gpg" :host t :protocol t)))
>       (setq auth-sources '((:source "~/.authinfo" :host t :protocol t)))
>     )
>   )
> )
...
> (load "tlrMail")

tlrMail.el
> (setq user-full-name "Tom Roche")
> (setq message-send-mail-function 'smtpmail-send-it)
> ;;; throw this in, anyway
> (setq send-mail-function 'smtpmail-send-it)

modified for mail (works in original)

> (setq foo-smtp-server-port 26)
> (setq foo-smtp-server-hostname "smtp.foo.com")
> (setq foo-user-mail-id "me")
> (setq foo-starttls-credentials
>   (list (list foo-smtp-server-hostname foo-smtp-server-port 'nil 'nil)))

...

> (setq smtpmail-local-domain pobox-domain-name)
> (setq smtpmail-sendto-domain pobox-domain-name)
> (setq smtpmail-smtp-server pobox-smtp-server-hostname)
> (setq smtpmail-smtp-service pobox-smtp-server-port)
> (setq user-mail-address pobox-user-mail-address)
> (setq smtpmail-starttls-credentials pobox-starttls-credentials)
...
> (setq starttls-use-gnutls t)
> (setq starttls-gnutls-program "gnutls-cli")
> (setq starttls-extra-arguments nil)
> (require 'smtpmail)

Vijay Lakshminarayanan Wed, 17 Aug 2011 09:07:05 +0530
> Open your .authinfo, C-x w .authinfo.gpg and Emacs will ask you for a
> password for the file.

So I did

1 C-x f ~/.authinfo
2 C-x w ~/.authinfo.gpg

and got dialog=*Keys*
> Select recipents for encryption.
> If no one is selected, symmetric encryption will be performed.
> - `m' to mark a key on the line
> - `u' to unmark a key on the line
> [Cancel][OK]

3 OK, then got 2 GnuPG passphrase prompts. I set a passphrase different
  from my SMTP server passwords.

4 I sent email, which succeeded normally, i.e., emacs prompted me for
  the SMTP server password, but I did not get a GnuPG prompt for passphrase.

5 rm ~/.authinfo

6 I tried to send email, but failed with

*Backtrace*
> Debugger entered--Lisp error: (error "Sending failed; SMTP protocol error")

7 Just to be sure, I did `C-x f ~/.authinfo.gpg` and got the GnuPG
  passphrase prompt followed by seeing the correct file contents in
  buffer.

8 Confused, I restarted emacs (normally), then tried to send email, I

* loaded the *Mail* buffer
* `C-c C-c`
* got 2 GnuPG passphrase prompts (why 2?)
* failed with

*Backtrace*
> Debugger entered--Lisp error: (error "Sending failed; SMTP protocol error")

9 More confused, I restarted the OS, then repeated the previous step: no change.

10 `C-x f ~/.authinfo.gpg` gets GnuPG passphrase prompt, followed by

*Messages*
> File exists, but cannot be read

   But I was able to open it before restarting emacs and the OS! Furthermore

me@it:~$ ls -al .authinfo.gpg
-rw-r--r-- 1 me me 183 Aug 17 10:29 .authinfo.gpg

11 .authinfo.gpg -> .authinfo

*`C-x f ~/.authinfo~`
* restore old contents
* `C-x w ~/.authinfo`
* `chmod 600 ~/.authinfo`
* verify:

me@it:~$ ls -al ~/.authinfo.gpg
ls: cannot access /home/me/.authinfo.gpg: No such file or directory
me@it:~$ ls -al ~/.authinfo
-rw------- 1 me me 260 Aug 17 11:56 /home/me/.authinfo

* try resending message (without restarting emacs): success!

How to fix (or further debug)?

Feel free to reply directly to me as well as the list, and TIA, Tom Roche 
<Tom_Roche@pobox.com>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]