diff options
| author | Kenichi Handa | 2012-02-17 16:33:15 +0900 |
|---|---|---|
| committer | Kenichi Handa | 2012-02-17 16:33:15 +0900 |
| commit | 48dd1e399f41aa349e8651d049cb4a707ffd0bb0 (patch) | |
| tree | 54a1d0b537b697ca2cb0bb420d125eafbbbb534c /doc/misc | |
| parent | c406be4337317c4ff4e60dc74a10921bd1102cac (diff) | |
| parent | bcc657043df41514ec80c3e172c6872b88221005 (diff) | |
| download | emacs-48dd1e399f41aa349e8651d049cb4a707ffd0bb0.tar.gz emacs-48dd1e399f41aa349e8651d049cb4a707ffd0bb0.zip | |
merge trunk
Diffstat (limited to 'doc/misc')
| -rw-r--r-- | doc/misc/ChangeLog | 5 | ||||
| -rw-r--r-- | doc/misc/smtpmail.texi | 211 |
2 files changed, 124 insertions, 92 deletions
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index adad93ef89c..a88ac5f0bd4 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2012-02-15 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * smtpmail.texi (Emacs Speaks SMTP): General update for 24.1. | ||
| 4 | (Encryption): New chapter, split out from previous. | ||
| 5 | |||
| 1 | 2012-02-13 Lars Ingebrigtsen <larsi@gnus.org> | 6 | 2012-02-13 Lars Ingebrigtsen <larsi@gnus.org> |
| 2 | 7 | ||
| 3 | * gnus.texi (Customizing the IMAP Connection): Mention | 8 | * gnus.texi (Customizing the IMAP Connection): Mention |
diff --git a/doc/misc/smtpmail.texi b/doc/misc/smtpmail.texi index af09783f445..4e4df3f0bbb 100644 --- a/doc/misc/smtpmail.texi +++ b/doc/misc/smtpmail.texi | |||
| @@ -47,6 +47,7 @@ developing GNU and promoting software freedom.'' | |||
| 47 | * How Mail Works:: Brief introduction to mail concepts. | 47 | * How Mail Works:: Brief introduction to mail concepts. |
| 48 | * Emacs Speaks SMTP:: How to use the SMTP library in Emacs. | 48 | * Emacs Speaks SMTP:: How to use the SMTP library in Emacs. |
| 49 | * Authentication:: Authenticating yourself to the server. | 49 | * Authentication:: Authenticating yourself to the server. |
| 50 | * Encryption:: Protecting your connection to the server. | ||
| 50 | * Queued delivery:: Sending mail without an internet connection. | 51 | * Queued delivery:: Sending mail without an internet connection. |
| 51 | * Server workarounds:: Mail servers with special requirements. | 52 | * Server workarounds:: Mail servers with special requirements. |
| 52 | * Debugging:: Tracking down problems. | 53 | * Debugging:: Tracking down problems. |
| @@ -129,24 +130,37 @@ be useful if you don't have a MTA set up on your host, or if your | |||
| 129 | machine is often disconnected from the internet. | 130 | machine is often disconnected from the internet. |
| 130 | 131 | ||
| 131 | Sending mail via SMTP requires configuring your mail user agent | 132 | Sending mail via SMTP requires configuring your mail user agent |
| 132 | (@pxref{Mail Methods,,,emacs}) to use the SMTP library. How to do | 133 | (@pxref{Mail Methods,,,emacs}) to use the SMTP library. If you |
| 133 | this should be described for each mail user agent; for the default | 134 | have not configured anything, then in Emacs 24.1 and later the first |
| 134 | mail user agent the variable @code{send-mail-function} (@pxref{Mail | 135 | time you try to send a mail Emacs will ask how you want to send |
| 135 | Sending,,,emacs}) is used; for the Message and Gnus user agents the | 136 | mail. To use this library, answer @samp{smtp} when prompted. Emacs |
| 136 | variable @code{message-send-mail-function} (@pxref{Mail | 137 | then asks for the name of the SMTP server. |
| 137 | Variables,,,message}) is used. | 138 | |
| 138 | 139 | If you prefer, or if you are using a non-standard mail user agent, | |
| 139 | @example | 140 | you can configure this yourself. The normal way to do this is to set |
| 140 | ;; If you use the default mail user agent. | 141 | the variable @code{send-mail-function} (@pxref{Mail |
| 142 | Sending,,,emacs}) to the value you want to use. To use this library: | ||
| 143 | |||
| 144 | @smallexample | ||
| 141 | (setq send-mail-function 'smtpmail-send-it) | 145 | (setq send-mail-function 'smtpmail-send-it) |
| 142 | ;; If you use Message or Gnus. | 146 | @end smallexample |
| 143 | (setq message-send-mail-function 'smtpmail-send-it) | 147 | |
| 144 | @end example | 148 | @noindent |
| 149 | The default value for this variable is @code{sendmail-query-once}, | ||
| 150 | which interactively asks how you want to send mail. | ||
| 151 | |||
| 152 | Your mail user agent might use a different variable for this purpose. | ||
| 153 | It should inherit from @code{send-mail-function}, but if it does not, | ||
| 154 | or if you prefer, you can set that variable directly. Consult your | ||
| 155 | mail user agent's documentation for more details. For example, | ||
| 156 | (@pxref{Mail Variables,,,message}). | ||
| 145 | 157 | ||
| 146 | Before using SMTP you must find out the hostname of the SMTP server | 158 | Before using SMTP you must find out the hostname of the SMTP server |
| 147 | to use. Your system administrator should provide you with this | 159 | to use. Your system administrator or mail service provider should |
| 148 | information, but often it is the same as the server you receive mail | 160 | supply this information. Often it is some variant of the server you |
| 149 | from. | 161 | receive mail from. If your email address is |
| 162 | @samp{yourname@@example.com}, then the name of the SMTP server is | ||
| 163 | may be something like @samp{smtp.example.com}. | ||
| 150 | 164 | ||
| 151 | @table @code | 165 | @table @code |
| 152 | @item smtpmail-smtp-server | 166 | @item smtpmail-smtp-server |
| @@ -201,101 +215,114 @@ The following example illustrates what you could put in | |||
| 201 | @node Authentication | 215 | @node Authentication |
| 202 | @chapter Authentication | 216 | @chapter Authentication |
| 203 | 217 | ||
| 218 | @cindex password | ||
| 219 | @cindex user name | ||
| 220 | Most SMTP servers require clients to authenticate themselves before | ||
| 221 | they are allowed to send mail. Authentication usually involves | ||
| 222 | supplying a user name and password. | ||
| 223 | |||
| 224 | If you have not configured anything, then the first time you try to | ||
| 225 | send mail via a server, Emacs (version 24.1 and later) prompts you | ||
| 226 | for the user name and password to use, and then offers to save the | ||
| 227 | information. By default, Emacs stores authentication information in | ||
| 228 | a file @file{~/.authinfo}. | ||
| 229 | |||
| 230 | @cindex authinfo | ||
| 231 | The basic format of the @file{~/.authinfo} file is one line for each | ||
| 232 | set of credentials. Each line consists of pairs of variables and | ||
| 233 | values. A simple example would be: | ||
| 234 | |||
| 235 | @smallexample | ||
| 236 | machine mail.example.org port 25 login myuser password mypassword | ||
| 237 | @end smallexample | ||
| 238 | |||
| 239 | @noindent | ||
| 240 | This specifies that when using the SMTP server called @samp{mail.example.org} | ||
| 241 | on port 25, Emacs should send the user name @samp{myuser} and the | ||
| 242 | password @samp{mypassword}. Either or both of the login and password | ||
| 243 | fields may be absent, in which case Emacs prompts for the information | ||
| 244 | when you try to send mail. (This replaces the old | ||
| 245 | @code{smtpmail-auth-credentials} variable used prior to Emacs 24.1.) | ||
| 246 | |||
| 247 | @vindex smtpmail-smtp-user | ||
| 248 | When the SMTP library connects to a host on a certain port, it | ||
| 249 | searches the @file{~/.authinfo} file for a matching entry. If an | ||
| 250 | entry is found, the authentication process is invoked and the | ||
| 251 | credentials are used. If the variable @code{smtpmail-smtp-user} is | ||
| 252 | set to a non-@code{nil} value, then only entries for that user are | ||
| 253 | considered. For more information on the @file{~/.authinfo} | ||
| 254 | file, @pxref{Top,,auth-source, auth, Emacs auth-source Library}. | ||
| 255 | |||
| 204 | @cindex SASL | 256 | @cindex SASL |
| 205 | @cindex CRAM-MD5 | 257 | @cindex CRAM-MD5 |
| 258 | @cindex PLAIN | ||
| 206 | @cindex LOGIN | 259 | @cindex LOGIN |
| 260 | The process by which the SMTP library authenticates you to the server | ||
| 261 | is known as ``Simple Authentication and Security Layer'' (SASL). | ||
| 262 | There are various SASL mechanisms, and this library supports three of | ||
| 263 | them: CRAM-MD5, PLAIN, and LOGIN. It tries each of them, in that order, | ||
| 264 | until one succeeds. The first uses a form of encryption to obscure | ||
| 265 | your password, while the other two do not. | ||
| 266 | |||
| 267 | |||
| 268 | @node Encryption | ||
| 269 | @chapter Encryption | ||
| 270 | |||
| 207 | @cindex STARTTLS | 271 | @cindex STARTTLS |
| 208 | @cindex TLS | 272 | @cindex TLS |
| 209 | @cindex SSL | 273 | @cindex SSL |
| 210 | Many environments require SMTP clients to authenticate themselves | 274 | For greater security, you can encrypt your connection to the SMTP |
| 211 | before they are allowed to route mail via a server. The two following | 275 | server. If this is to work, both Emacs and the server must support it. |
| 212 | variables contains the authentication information needed for this. | 276 | |
| 213 | 277 | The SMTP library supports the ``Transport Layer Security'' (TLS), and | |
| 214 | The first variable, @code{smtpmail-auth-credentials}, instructs the | 278 | the older ``Secure Sockets Layer'' (SSL) encryption mechanisms. |
| 215 | SMTP library to use a SASL authentication step, currently only the | 279 | It also supports STARTTLS, which is a variant of TLS in which the |
| 216 | CRAM-MD5 and LOGIN mechanisms are supported and will be selected in | 280 | initial connection to the server is made in plain text, requesting a |
| 217 | that order if the server support both. | 281 | switch to an encrypted channel for the rest of the process. |
| 218 | 282 | ||
| 219 | The second variable, @code{smtpmail-starttls-credentials}, instructs | 283 | @vindex smtpmail-stream-type |
| 220 | the SMTP library to connect to the server using STARTTLS. This means | 284 | The variable @code{smtpmail-stream-type} controls what form of |
| 221 | the protocol exchange may be integrity protected and confidential by | 285 | connection the SMTP library uses. The default value is @code{nil}, |
| 222 | using the Transport Layer Security (TLS) protocol, and optionally also | 286 | which means to use a plain connection, but try to switch to a STARTTLS |
| 223 | authentication of the client and server. | 287 | encrypted connection if the server supports it. Other possible values |
| 224 | 288 | are: @code{starttls} - insist on STARTTLS; @code{ssl} - use TLS/SSL; | |
| 225 | TLS is a security protocol that is also known as SSL, although | 289 | and @code{plain} - no encryption. |
| 226 | strictly speaking, SSL is an older variant of TLS. TLS is backwards | 290 | |
| 227 | compatible with SSL. In most mundane situations, the two terms are | 291 | Use of any form of TLS/SSL requires support in Emacs. You can either |
| 228 | equivalent. | 292 | use the built-in support (in Emacs 24.1 and later), or the |
| 229 | 293 | @file{starttls.el} Lisp library. The built-in support uses the GnuTLS | |
| 230 | The TLS feature uses the elisp package @file{starttls.el} (see it for | 294 | @footnote{@url{http://www.gnu.org/software/gnutls/}} library. |
| 231 | more information on customization), which in turn require that at | 295 | If your Emacs has GnuTLS support built-in, the function |
| 232 | least one of the following external tools are installed: | 296 | @code{gnutls-available-p} is defined and returns non-@code{nil}. |
| 297 | Otherwise, you must use the @file{starttls.el} library (see that file for | ||
| 298 | more information on customization options, etc.). The Lisp library | ||
| 299 | requires one of the following external tools to be installed: | ||
| 233 | 300 | ||
| 234 | @enumerate | 301 | @enumerate |
| 235 | @item | 302 | @item |
| 236 | The GnuTLS command line tool @samp{gnutls-cli}, you can get it from | 303 | The GnuTLS command line tool @samp{gnutls-cli}, which you can get from |
| 237 | @url{http://www.gnu.org/software/gnutls/}. This is the recommended | 304 | @url{http://www.gnu.org/software/gnutls/}. This is the recommended |
| 238 | tool, mainly because it can verify the server certificates. | 305 | tool, mainly because it can verify server certificates. |
| 239 | 306 | ||
| 240 | @item | 307 | @item |
| 241 | The @samp{starttls} external program, you can get it from | 308 | The @samp{starttls} external program, which you can get from |
| 242 | @file{starttls-*.tar.gz} from @uref{ftp://ftp.opaopa.org/pub/elisp/}. | 309 | @file{starttls-*.tar.gz} from @uref{ftp://ftp.opaopa.org/pub/elisp/}. |
| 243 | @end enumerate | 310 | @end enumerate |
| 244 | 311 | ||
| 245 | It is not uncommon to use both these mechanisms, e.g., to use STARTTLS | 312 | @cindex certificates |
| 246 | to achieve integrity and confidentiality and then use SASL for client | 313 | @cindex keys |
| 247 | authentication. | 314 | The SMTP server may also request that you verify your identity by |
| 315 | sending a certificate and the associated encryption key to the server. | ||
| 316 | If you need to do this, you can use an @file{~/.authinfo} entry like this: | ||
| 248 | 317 | ||
| 249 | @table @code | 318 | @smallexample |
| 250 | @item smtpmail-auth-credentials | 319 | machine mail.example.org port 25 key "~/.my_smtp_tls.key" cert "~/.my_smtp_tls.cert" |
| 251 | @vindex smtpmail-auth-credentials | 320 | @end smallexample |
| 252 | The variable @code{smtpmail-auth-credentials} contains a list of | ||
| 253 | hostname, port, username and password tuples. When the SMTP library | ||
| 254 | connects to a host on a certain port, this variable is searched to | ||
| 255 | find a matching entry for that hostname and port. If an entry is | ||
| 256 | found, the authentication process is invoked and the credentials are | ||
| 257 | used. | ||
| 258 | |||
| 259 | The hostname field follows the same format as | ||
| 260 | @code{smtpmail-smtp-server} (i.e., a string) and the port field the | ||
| 261 | same format as @code{smtpmail-smtp-service} (i.e., a string or an | ||
| 262 | integer). The username and password fields, which either can be | ||
| 263 | @code{nil} to indicate that the user is prompted for the value | ||
| 264 | interactively, should be strings with the username and password, | ||
| 265 | respectively, information that is normally provided by system | ||
| 266 | administrators. | ||
| 267 | |||
| 268 | @item smtpmail-starttls-credentials | ||
| 269 | @vindex smtpmail-starttls-credentials | ||
| 270 | The variable @code{smtpmail-starttls-credentials} contains a list of | ||
| 271 | tuples with hostname, port, name of file containing client key, and | ||
| 272 | name of file containing client certificate. The processing is similar | ||
| 273 | to the previous variable. The client key and certificate may be | ||
| 274 | @code{nil} if you do not wish to use client authentication. | ||
| 275 | @end table | ||
| 276 | 321 | ||
| 277 | The following example illustrates what you could put in | 322 | @noindent |
| 278 | @file{~/.emacs} to enable both SASL authentication and STARTTLS. The | 323 | (This replaces the old @code{smtpmail-starttls-credentials} variable used |
| 279 | server name (@code{smtpmail-smtp-server}) is @var{hostname}, the | 324 | prior to Emacs 24.1.) |
| 280 | server port (@code{smtpmail-smtp-service}) is @var{port}, and the | ||
| 281 | username and password are @var{username} and @var{password} | ||
| 282 | respectively. | ||
| 283 | 325 | ||
| 284 | @example | ||
| 285 | ;; Authenticate using this username and password against my server. | ||
| 286 | (setq smtpmail-auth-credentials | ||
| 287 | '(("@var{hostname}" "@var{port}" "@var{username}" "@var{password}"))) | ||
| 288 | |||
| 289 | ;; Note that if @var{port} is an integer, you must not quote it as a | ||
| 290 | ;; string. Normally @var{port} should be the integer 25, and the example | ||
| 291 | ;; become: | ||
| 292 | (setq smtpmail-auth-credentials | ||
| 293 | '(("@var{hostname}" 25 "@var{username}" "@var{password}"))) | ||
| 294 | |||
| 295 | ;; Use STARTTLS without authentication against the server. | ||
| 296 | (setq smtpmail-starttls-credentials | ||
| 297 | '(("@var{hostname}" "@var{port}" nil nil))) | ||
| 298 | @end example | ||
| 299 | 326 | ||
| 300 | @node Queued delivery | 327 | @node Queued delivery |
| 301 | @chapter Queued delivery | 328 | @chapter Queued delivery |