From: Tom Roche <Tom_Roche@pobox.com>
To: help-gnu-emacs@gnu.org,
Subject: problem using .authinfo.gpg with smtpmail
Date: Wed, 17 Aug 2011 12:21:06 -0400 [thread overview]
Message-ID: <87d3g41025.fsf@pobox.com> (raw)
In-Reply-To: 87liusrh3h.fsf@pobox.com
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>
next prev parent reply other threads:[~2011-08-17 16:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-17 0:56 extract smtpmail data from .authinfo (or .authinfo.gpg)? Tom Roche
2011-08-17 3:37 ` Vijay Lakshminarayanan
2011-08-17 16:21 ` Tom Roche [this message]
2011-08-17 16:47 ` Tom Roche
2011-08-17 18:03 ` Ian Zimmerman
2011-08-26 22:40 ` Tom Roche
2011-09-07 0:33 ` Ian Zimmerman
[not found] <87d3frx23d.fsf@pobox.com>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87d3g41025.fsf@pobox.com \
--to=tom_roche@pobox.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.