aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Josefsson2003-02-23 12:09:45 +0000
committerSimon Josefsson2003-02-23 12:09:45 +0000
commit15a21dbf8e957005e9247b25beff07d992c43644 (patch)
tree6039890220e3a379c1194cedf133a0a198546028
parentb1d28079715ac1d11c936340df76cba3a8aa9e0a (diff)
downloademacs-15a21dbf8e957005e9247b25beff07d992c43644.tar.gz
emacs-15a21dbf8e957005e9247b25beff07d992c43644.zip
Manual for smtpmail.el.
-rw-r--r--man/smtpmail.texi309
1 files changed, 309 insertions, 0 deletions
diff --git a/man/smtpmail.texi b/man/smtpmail.texi
new file mode 100644
index 00000000000..fd0d5b07d33
--- /dev/null
+++ b/man/smtpmail.texi
@@ -0,0 +1,309 @@
1\input texinfo @c -*-texinfo-*-
2@setfilename ../info/smtpmail
3@settitle Emacs SMTP Library
4@syncodeindex vr fn
5@copying
6Copyright @copyright{} 2003 Free Software Foundation, Inc.
7
8@quotation
9Permission is granted to copy, distribute and/or modify this document
10under the terms of the GNU Free Documentation License, Version 1.1 or
11any later version published by the Free Software Foundation; with the
12Invariant Sections being ``The GNU Manifesto'', ``Distribution'' and
13``GNU GENERAL PUBLIC LICENSE'', with the Front-Cover texts being ``A GNU
14Manual'', and with the Back-Cover Texts as in (a) below. A copy of the
15license is included in the section entitled ``GNU Free Documentation
16License'' in the Emacs manual.
17
18(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
19this GNU Manual, like GNU software. Copies published by the Free
20Software Foundation raise funds for GNU development.''
21
22This document is part of a collection distributed under the GNU Free
23Documentation License. If you want to distribute this document
24separately from the collection, you can do so by adding a copy of the
25license to the document, as described in section 6 of the license.
26@end quotation
27@end copying
28
29@dircategory Emacs
30@direntry
31* Emacs SMTP Library: (smtpmail). Emacs library for sending mail via SMTP.
32@end direntry
33
34@titlepage
35@title{Emacs SMTP Library}
36@subtitle{An Emacs package for sending mail via SMTP}
37@author{Simon Josefsson}
38@end titlepage
39
40@node Top
41@chapter Sending mail via SMTP
42@cindex SMTP
43
44 On the Internet, mail is sent from host to host using the simple
45mail transfer protocol (SMTP). When you read and write mail you are
46using a mail program that does not use SMTP --- it just reads mails
47from files. This is called a mail user agent (MUA). The mail
48transfer agent (MTA) is the program that accepts mails via SMTP and
49stores them in files. You also need a mail transfer agent when you
50send mails. Your mail program has to send its mail to a MTA that can
51pass it on using SMTP.
52
53 Emacs includes a package for sending your mail to a SMTP server and
54have it take care of delivering it to the final destination, rather
55than letting the MTA on your local system take care of it. This can
56be useful if you don't have a MTA set up on your host, or if your
57machine is often disconnected from the Internet.
58
59 Sending mail via SMTP requires configuring your mail user agent
60(@pxref{Mail Methods,,,emacs}) to use the SMTP library. How to do
61this should be described for each mail user agent; for the default
62mail user agent the variable @code{send-mail-function} (@pxref{Mail
63Sending,,,emacs}) is used; for the Message and Gnus user agents the
64variable @code{message-send-mail-function} (@pxref{Mail
65Variables,,,message}) is used.
66
67@example
68;; If you use the default mail user agent.
69(setq send-mail-function 'smtpmail-send-it)
70;; If you use Message or Gnus.
71(setq message-send-mail-function 'smtpmail-send-it)
72@end example
73
74 Before using SMTP you must find out the hostname of the SMTP server
75to use. Your system administrator should provide you with this
76information, but often it is the same as the server you receive mail
77from.
78
79@table @code
80@item smtpmail-smtp-server
81@vindex smtpmail-smtp-server
82@vindex SMTPSERVER
83 The variable @code{smtpmail-smtp-server} controls the hostname of
84the server to use. It is a string with an IP address or hostname. It
85defaults to the contents of the @code{SMTPSERVER} environment
86variable, or, if empty, the contents of
87@code{smtpmail-default-smtp-server}.
88
89@item smtpmail-default-smtp-server
90@vindex smtpmail-default-smtp-server
91 The variable @code{smtpmail-default-smtp-server} controls the
92default hostname of the server to use. It is a string with an IP
93address or hostname. It must be set before the SMTP library is
94loaded. It has no effect if set after the SMTP library has been
95loaded, or if @code{smtpmail-smtp-server} is defined. It is usually
96set by system administrators in a site wide initialization file.
97@end table
98
99The following example illustrates what you could put in
100@file{~/.emacs} to set the SMTP server name.
101
102@example
103;; Send mail using SMTP via mail.example.org.
104(setq smtpmail-smtp-server "mail.example.org")
105@end example
106
107@cindex Mail Submission
108SMTP is normally used on the registered ``smtp'' TCP service port 25.
109Some environments use SMTP in ``Mail Submission'' mode, which uses
110port 587. Using other ports is not uncommon, either for security by
111obscurity purposes, port forwarding, or otherwise.
112
113@table @code
114@item smtpmail-smtp-service
115@vindex smtpmail-smtp-service
116 The variable @code{smtpmail-smtp-service} controls the port on the
117server to contact. It is either a string, in which case it will be
118translated into an integer using system calls, or an integer.
119@end table
120
121The following example illustrates what you could put in
122@file{~/.emacs} to set the SMTP service port.
123
124@example
125;; Send mail using SMTP on the mail submission port 587.
126(setq smtpmail-smtp-service 587)
127@end example
128
129@menu
130* Authentication:: Authenticating yourself to the server.
131* Queued delivery:: Sending mail without an Internet connection.
132* Server workarounds:: Mail servers with special requirements.
133* Debugging:: Tracking down problems.
134* Index:: Index over variables and functions.
135@end menu
136
137@node Authentication
138@section Authentication
139
140Many environments require SMTP clients to authenticate themselves
141before they are allowed to route mail via a server. The two following
142variables contains the authentication information needed for this.
143The first variable, @code{smtpmail-auth-credentials}, instructs the
144SMTP library to use a SASL authentication step, currently only the
145CRAM-MD5, PLAIN and LOGIN-MD5 mechanisms are supported and will be
146selected in that order if the server supports them. The second
147variable, @code{smtpmail-starttls-credentials}, instructs the SMTP
148library to connect to the server using STARTTLS. This means the
149protocol exchange can be integrity protected and confidential by using
150TLS, and optionally also authentication of the client. It is common
151to use both these mechanisms, e.g., to use STARTTLS to achieve
152integrity and confidentiality and then use SASL for client
153authentication.
154
155@table @code
156@item smtpmail-auth-credentials
157@vindex smtpmail-auth-credentials
158 The variable @code{smtpmail-auth-credentials} contains a list of
159hostname, port, username and password tuples. When the SMTP library
160connects to a host on a certain port, this variable is searched to
161find a matching entry for that hostname and port. If an entry is
162found, the authentication process is invoked and the credentials are
163used. The hostname field follows the same format as
164@code{smtpmail-smtp-server} (i.e., a string) and the port field the
165same format as @code{smtpmail-smtp-service} (i.e., a string or an
166integer). The username and password fields, which either can be
167@samp{nil} to indicate that the user is queried for the value
168interactively, should be strings with the username and password,
169respectively, information that is normally provided by system
170administrators.
171
172@item smtpmail-starttls-credentials
173@vindex smtpmail-starttls-credentials
174 The variable @code{smtpmail-starttls-credentials} contains a list of
175tuples with hostname, port, name of file containing client key, and
176name of file containing client certificate. The processing is similar
177to the previous variable. The client key and certificate may be
178@samp{nil} if you do not wish to use client authentication. The use
179of this variable requires the @samp{starttls} external program to be
180installed, you can get @file{starttls-*.tar.gz} from
181@uref{ftp://ftp.opaopa.org/pub/elisp/}.
182@end table
183
184The following example illustrates what you could put in
185@file{~/.emacs} to enable both SASL authentication and STARTTLS. The
186server name (@code{smtpmail-smtp-server}) is @var{hostname}, the
187server port (@code{smtpmail-smtp-service}) is @var{port}, and the
188username and password are @var{username} and "@var{password}
189respectively.
190
191@example
192;; Authenticate using this username and password against my server.
193(setq smtpmail-auth-credentials
194 '(("@var{hostname}" "@var{port}" "@var{username}" "@var{password}")))
195;; Use STARTTLS without authentication against the server.
196(setq smtpmail-starttls-credentials
197 '(("@var{hostname}" "@var{port}" nil nil)))
198@end example
199
200@node Queued delivery
201@section Queued delivery
202
203If you connect to the Internet via a dialup connection, or for some
204other reason doesn't have permanent Internet connection, sending mail
205will fail when you are not connected. The SMTP library implements
206queued delivery, and the following variable control its behaviour.
207
208@table @code
209
210@item smtpmail-queue-mail
211@vindex smtpmail-queue-mail
212 The variable @code{smtpmail-queue-mail} controls whether a simple
213off line mail sender is active. This variable is a boolean, and
214defaults to @samp{nil} (disabled). If this is non-nil, mail is not
215sent immediately but rather queued in the directory
216@code{smtpmail-queue-dir} and can be later sent manually by invoking
217@code{smtpmail-send-queued-mail} (typically when you connect to the
218Internet).
219
220@item smtpmail-queue-mail
221@vindex smtpmail-queue-dir
222 The variable @code{smtpmail-queue-dir} specifies the name of the
223directory to hold queued messages. It defaults to
224@file{~/Mail/queued-mail/}.
225
226@findex smtpmail-send-queued-mail
227 The function @code{smtpmail-send-queued-mail} can be used to send
228any queued mail when @code{smtpmail-queue-mail} is enabled. It is
229typically invoked interactively with @kbd{M-x RET
230smtpmail-send-queued-mail RET} when you are connected to the Internet.
231
232@end table
233
234
235@node Server workarounds
236@section Server workarounds
237
238Some SMTP servers have special requirements. The following variables
239implement support for common requirements.
240
241@table @code
242
243@item smtpmail-local-domain
244@vindex smtpmail-local-domain
245 The variable @code{smtpmail-local-domain} controls the hostname sent
246in the first @code{EHLO} or @code{HELO} command sent to the server.
247It should only be set if the @code{system-name} function returns a
248name that isn't accepted by the server. Do not set this variable
249unless your server complains.
250
251@item smtpmail-sendto-domain
252@vindex smtpmail-sendto-domain
253 The variable @code{smtpmail-sendto-domain} makes the SMTP library
254add @samp{@@} and the specified value to recipients specified in the
255message when they are sent using the @code{RCPT TO} command. Some
256configurations of sendmail requires this behaviour. Don't bother to
257set this unless you have get an error like:
258
259@example
260 Sending failed; SMTP protocol error
261@end example
262
263when sending mail, and the debug buffer (@pxref{Debugging})) contains
264an error such as:
265
266@example
267 RCPT TO: @var{someone}
268 501 @var{someone}: recipient address must contain a domain
269@end example
270
271@end table
272
273
274@node Debugging
275@section Debugging
276
277Sometimes delivery fails, often with the generic error message
278@samp{Sending failed; SMTP protocol error}. Enabling one or both of
279the following variables and inspecting a trace buffer will often give
280clues to the reason for the error.
281
282@table @code
283
284@item smtpmail-debug-info
285@vindex smtpmail-debug-info
286 The variable @code{smtpmail-debug-info} controls whether to print
287the SMTP protocol exchange in the minibuffer, and retain the entire
288exchange in a buffer @samp{*trace of SMTP session to @var{server}*},
289where @var{server} is the name of the mail server to which you send
290mail.
291
292@item smtpmail-debug-verb
293@vindex smtpmail-debug-verb
294 The variable @code{smtpmail-debug-verb} controls whether to send the
295@code{VERB} token to the server. The @code{VERB} server instructs the
296server to be more verbose, and often also to attempt final delivery
297while your SMTP session is still running. It is usually only useful
298together with @code{smtpmail-debug-info}. Note that this may cause
299mail delivery to take considerable time if the final destination
300cannot accept mail.
301
302@end table
303
304@node Index
305@section Function and Variable Index
306@printindex fn
307
308@contents
309@bye