On Mon, 21 Mar 2011 10:20:22 -0400 Stefan Monnier wrote: >> 1) ask the user about the SMTP server name if `smtpmail-auth-source' is >> nil (the default) >> 2) ask the user if the server connection info should be saved through >> auth-source SM> I guess such a question might sound unclear to an unsuspecting user; SM> but if you phrase it as "do you need to use authentication" or something SM> like that, it would be fine. >> 3) if yes, do the auth-source creation prompts for user, port, and >> password >> 4) use Customize to save `smtpmail-host', `smtpmail-port', and >> `smtpmail-auth-source' to t or 'never according to (2). From now on the >> user will either just use `smtpmail-host' and `smtpmail-port' or call >> `auth-source-search' with :host ,smtpmail-host and (if the port is not >> nil) :port ,smtpmail-port This is implemented with `smtpmail-use-auth-source' set to 'ask by default and then either t or nil as the user may desire. `smtpmail-smtp-server' and `smtpmail-smtp-service' are obtained with `read-string' and then we call `customize-save-variable' on them. All this happens in `smtpmail-via-smtp' and not `smtpmail-try-auth-methods'. The :save-function is called on a successful auth exchange. The patch is pretty simple overall. You'll see that the creation prompts are just for the user and the password, since the port and host are guaranteed to be defined from earlier. I'd also like to remove the netrc-* function calls if no one objects. It would break people that expect ~/.authinfo and ~/.netrc to work. Those are the usual defaults of `netrc-file' but we strongly encourage ~/.authinfo.gpg now, so I think the damage is justified as it may get former netrc.el users to consider secure alternatives like EPA/EPG or the Secrets API. Ted