comparison man/sending.texi @ 49923:6977eaede7a8

Remove SMTP section. Document send-mail-function and refer to the Emacs SMTP Library manual.
author Simon Josefsson <jas@extundo.com>
date Sun, 23 Feb 2003 12:09:07 +0000
parents a8516da63375
children b65aa1d740eb
comparison
equal deleted inserted replaced
49922:d278896aa13f 49923:6977eaede7a8
80 * Headers: Mail Headers. Details of permitted mail header fields. 80 * Headers: Mail Headers. Details of permitted mail header fields.
81 * Aliases: Mail Aliases. Abbreviating and grouping mail addresses. 81 * Aliases: Mail Aliases. Abbreviating and grouping mail addresses.
82 * Mode: Mail Mode. Special commands for editing mail being composed. 82 * Mode: Mail Mode. Special commands for editing mail being composed.
83 * Amuse: Mail Amusements. Distracting the NSA; adding fortune messages. 83 * Amuse: Mail Amusements. Distracting the NSA; adding fortune messages.
84 * Methods: Mail Methods. Using alternative mail-composition methods. 84 * Methods: Mail Methods. Using alternative mail-composition methods.
85 * SMTP: Sending via SMTP. Sending mail via SMTP.
86 @end menu 85 @end menu
87 86
88 @node Mail Format 87 @node Mail Format
89 @section The Format of the Mail Buffer 88 @section The Format of the Mail Buffer
90 89
436 @code{sendmail-coding-system} (@pxref{Recognize Coding}). 435 @code{sendmail-coding-system} (@pxref{Recognize Coding}).
437 436
438 If the coding system thus determined does not handle the characters in 437 If the coding system thus determined does not handle the characters in
439 a particular message, Emacs asks you to select the coding system to use, 438 a particular message, Emacs asks you to select the coding system to use,
440 showing a list of possible coding systems. 439 showing a list of possible coding systems.
440
441 @cindex SMTP
442 @cindex Feedmail
443 @cindex Sendmail
444 @vindex send-mail-function
445 The variable @code{send-mail-function} controls how the default mail
446 user agent sends mail. It should be set to a function. The default
447 is @code{sendmail-send-it}, which delivers mail using the Sendmail
448 installation on the local host. To send mail through a SMTP server,
449 set it to @code{smtpmail-send-it} and set up the Emacs SMTP library
450 (@pxref{Sending mail via SMTP,,,smtpmail}). A third option is
451 @code{feedmail-send-it}, see the commentary section of the
452 @file{feedmail.el} package for more information.
441 453
442 @node Header Editing 454 @node Header Editing
443 @subsection Mail Header Editing 455 @subsection Mail Header Editing
444 456
445 Mail mode provides special commands to move to particular header 457 Mail mode provides special commands to move to particular header
689 701
690 If you select a different mail-composition method, the information 702 If you select a different mail-composition method, the information
691 in this chapter about the @samp{*mail*} buffer and Mail mode does not 703 in this chapter about the @samp{*mail*} buffer and Mail mode does not
692 apply; the other methods use a different format of text in a different 704 apply; the other methods use a different format of text in a different
693 buffer, and their commands are different as well. 705 buffer, and their commands are different as well.
694
695 @node Sending via SMTP
696 @section Sending via SMTP
697 @cindex SMTP
698
699 On the Internet, mail is sent from host to host using the simple
700 mail transfer protocol (SMTP). When you read and write mail you are
701 using a mail program that does not use SMTP -- it just reads mails
702 from files. This is called a mail user agent (MUA). The mail
703 transfer agent (MTA) is the program that accepts mails via SMTP and
704 stores them in files. You also need a mail transfer agent when you
705 send mails. Your mail program has to send its mail to a MTA that can
706 pass it on using SMTP.
707
708 Emacs includes a package for sending your mail to a SMTP server and
709 have it take care of delivering it to the final destination, rather
710 than letting the MTA on your local system take care of it. This can
711 be useful if you don't have a MTA set up on your host, or if your
712 machine is often disconnected from the Internet.
713
714 Sending mail via SMTP requires configuring your mail user agent
715 (@pxref{Mail Methods}) to use the SMTP library. How to do this should
716 be described for each mail user agent; for the Message and Gnus user
717 agents the variable @code{message-send-mail-function} (@pxref{Mail
718 Variables,,,message}) is used.
719
720 @vindex send-mail-function
721 The variable @code{send-mail-function} controls how the default mail
722 user agent sends mail. It should be set to a function. The default
723 is @code{sendmail-send-it}, but must be set to @code{smtpmail-send-it}
724 in order to use the SMTP library. @code{feedmail-send-it} is another
725 option.
726
727 Before using SMTP you must find out the hostname of the SMTP server
728 to use. Your system administrator should provide you with this
729 information, but often it is the same as the server you receive mail
730 from.
731
732 @vindex smtpmail-smtp-server
733 The variable @code{smtpmail-smtp-server} controls the hostname of
734 the server to use. It is a string with an IP address or hostname. It
735 defaults to the contents of the @code{SMTPSERVER} environment
736 variable, or, if empty, the contents of
737 @code{smtpmail-default-smtp-server}.
738
739 @vindex smtpmail-default-smtp-server
740 The variable @code{smtpmail-default-smtp-server} controls the
741 default hostname of the server to use. It is a string with an IP
742 address or hostname. It must be set before the SMTP library is
743 loaded. It has no effect if set after the SMTP library has been
744 loaded, or if @code{smtpmail-smtp-server} is defined. It is usually
745 set by system administrators in a site wide initialization file.
746
747 @cindex Mail Submission
748 SMTP is normally used on the registered ``smtp'' TCP service port 25.
749 Some environments use SMTP in ``Mail Submission'' mode, which uses
750 port 587. Using other ports is not uncommon, either for security by
751 obscurity purposes, port forwarding, or otherwise.
752
753 @vindex smtpmail-smtp-service
754 The variable @code{smtpmail-smtp-service} controls the port on the
755 server to contact. It is either a string, in which case it will be
756 translated into an integer using system calls, or an integer.
757
758 Many environments require SMTP clients to authenticate themselves
759 before they are allowed to route mail via a server. The two following
760 variables contains the authentication information needed for this.
761 The first variable, @code{smtpmail-auth-credentials}, instructs the
762 SMTP library to use a SASL authentication step, currently only the
763 CRAM-MD5, PLAIN and LOGIN-MD5 mechanisms are supported and will be
764 selected in that order if the server supports them. The second
765 variable, @code{smtpmail-starttls-credentials}, instructs the SMTP
766 library to connect to the server using STARTTLS. This means the
767 protocol exchange can be integrity protected and confidential by using
768 TLS, and optionally also authentication of the client. It is common
769 to use both these mechanisms, e.g. to use STARTTLS to achieve
770 integrity and confidentiality and then use SASL for client
771 authentication.
772
773 @vindex smtpmail-auth-credentials
774 The variable @code{smtpmail-auth-credentials} contains a list of
775 hostname, port, username and password tuples. When the SMTP library
776 connects to a host on a certain port, this variable is searched to
777 find a matching entry for that hostname and port. If an entry is
778 found, the authentication process is invoked and the credentials are
779 used. The hostname field follows the same format as
780 @code{smtpmail-smtp-server} (i.e., a string) and the port field the
781 same format as @code{smtpmail-smtp-service} (i.e., a string or an
782 integer). The username and password fields, which either can be
783 @samp{nil} to indicate that the user is queried for the value
784 interactively, should be strings with the username and password,
785 respectively, information that is normally provided by system
786 administrators.
787
788 @vindex smtpmail-starttls-credentials
789 The variable @code{smtpmail-starttls-credentials} contains a list of
790 tuples with hostname, port, name of file containing client key, and
791 name of file containing client certificate. The processing is similar
792 to the previous variable. The client key and certificate may be
793 @samp{nil} if you do not wish to use client authentication. The use
794 of this variable requires the @samp{starttls} external program to be
795 installed, you can get it from
796 @samp{ftp://ftp.opaopa.org/pub/elisp/starttls-*.tar.gz}.
797
798 The remaining variables are more esoteric and is normally not needed.
799
800 @vindex smtpmail-debug-info
801 The variable @code{smtpmail-debug-info} controls whether to print
802 the SMTP protocol exchange in the minibuffer, and retain the entire
803 exchange in a buffer @samp{*trace of SMTP session to
804 mail.example.org*}.
805
806 @vindex smtpmail-debug-verb
807 The variable @code{smtpmail-debug-verb} controls whether to send the
808 VERB token to the server. The VERB server instructs the server to be
809 more verbose, and often also to attempt final delivery while your SMTP
810 session is still running. It is usually only useful together with
811 @code{smtpmail-debug-info}. Note that this may cause mail delivery to
812 take considerable time if the final destination cannot accept mail.
813
814 @vindex smtpmail-local-domain
815 The variable @code{smtpmail-local-domain} controls the hostname sent
816 in the first EHLO or HELO command sent to the server. It should only
817 be set if the @code{system-name} function returns a name that isn't
818 accepted by the server. Do not set this variable unless your server
819 complains.
820
821 @vindex smtpmail-sendto-domain
822 The variable @code{smtpmail-sendto-domain} makes the SMTP library
823 add @samp{@@} and the specified value to recipients specified in the
824 message when they are sent using the RCPT TO command. Some
825 configurations of sendmail requires this behaviour. Don't bother to
826 set this unless you have get an error like:
827
828 @example
829 Sending failed; SMTP protocol error
830 @end example
831
832 when sending mail, and the *trace of SMTP session to <somewhere>*
833 buffer (enabled via @code{smtpmail-debug-info}) includes an exchange
834 like:
835
836 @example
837 RCPT TO: <someone>
838 501 <someone>: recipient address must contain a domain
839 @end example
840
841 @vindex smtpmail-queue-mail
842 The variable @code{smtpmail-queue-mail} controls whether a simple
843 off line mail sender is active. This variable is a boolean, and
844 defaults to @samp{nil} (disabled). If this is non-nil, mail is not
845 sent immediately but rather queued in the directory
846 @code{smtpmail-queue-dir} and can be later sent manually by invoking
847 @code{smtpmail-send-queued-mail} (typically when you connect to the
848 Internet).
849
850 @vindex smtpmail-queue-dir
851 The variable @code{smtpmail-queue-dir} specifies the name of the
852 directory to hold queued messages. It defaults to
853 @samp{~/Mail/queued-mail/}.
854
855 @findex smtpmail-send-queued-mail
856 The function @code{smtpmail-send-queued-mail} can be used to send
857 any queued mail when @code{smtpmail-queue-mail} is enabled. It is
858 typically invoked interactively with @kbd{M-x RET
859 smtpmail-send-queued-mail RET} when you are connected to the Internet.