The auth-source lookup done by smtpmail uses the smtpmail-smtp-service port as well, so you need to specify '587' in .authinfo.gpg (although personally I advocate for using port 465 and a stream-type of 'tls).
The prompt I see without any configuration is:
Password for 'https://firstname.lastname@example.org':
this corresponds to the used remote url:
I then added an entry like this:
machine email@example.com password 12345
and added the function to the hook:
Thanks to Marco Wahl and this emacs documentation I came up with the following emacs-lisp to put in the PROPERTIES drawer:
:header-args: :dbpassword: (funcall (plist-get (nth 0 (auth-source-search :user "Peter" :port 3306 :require '(:secret))) :secret))
The :port is not needed but I figured it would help narrow down the search ...
You could use a suitable lisp-function which returns the suitable string.
E.g. if you already had function `my-secret-password' which picks the password for a user, you could write
** MySQL Analysis
:header-args: :engine: mysql
:header-args: :dbhost: localhost
:header-args: :database: MY_DB
:header-args: :dbuser: DB_GUY
as per the comment from @rpluim adding the port outlook.office365.com:443 did the job nicely:
machine outlook.office365.com:443 port https login firstname.lastname@example.org password changeme123
Don't forget that Emacs comes with built-in GPG support, so you can encrypt this file easily by naming it ~/.authinfo.gpg
This is the same question as discussed in https://debbugs.gnu.org/46674
In short: Use Tramp 2.5 from GNU ELPA, and apply in your .emacs
'remote-without-auth-sources '((auth-sources . nil)))
'(:application tramp) 'remote-without-auth-sources)
You can create your own command to set all variables before starting ERC:
(defun my/erc-freenode ()
(let ((erc-plist (car (auth-source-search :host "irc.freenode.net")))
(setq erc-server "irc.freenode.net")
(setq erc-nick (plist-get erc-plist :user))
(setq erc-password (funcall (plist-get ...
The first thing to do is confirm which fields need to be included in the secret. Frequently this includes host and user. For smtp, this also includes port. You can find this information by looking for an auth-source-search call (or using edebug to pause execution on it).
If all you need is host and user, you can use a graphical client like Seahorse if you ...