Mercurial > emacs
comparison lisp/mail/sendmail.el @ 111961:0604fca5939a
Misc sendmail.el.
* lisp/mail/sendmail.el: Don't require rmail or mailalias when compiling.
Require mail-utils.
(mail-alias-file): Don't autoload. Doc fix.
(mail-bury-selects-summary, mail-send-nonascii): Don't autoload.
(mail-mailer-swallows-blank-line): Default to nil. Doc fix.
Mark as obsolete, and risky.
(mail-setup): Simplify.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Mon, 13 Dec 2010 21:01:08 -0800 |
parents | 4db798bcd48b |
children | 6c6130ccdefd |
comparison
equal
deleted
inserted
replaced
111960:b856b44c139b | 111961:0604fca5939a |
---|---|
26 | 26 |
27 ;; This mode provides mail-sending facilities from within Emacs. It is | 27 ;; This mode provides mail-sending facilities from within Emacs. It is |
28 ;; documented in the Emacs user's manual. | 28 ;; documented in the Emacs user's manual. |
29 | 29 |
30 ;;; Code: | 30 ;;; Code: |
31 (eval-when-compile | 31 (require 'mail-utils) |
32 ;; Necessary to avoid recursive `require's. | |
33 (provide 'sendmail) | |
34 (require 'rmail) | |
35 (require 'mailalias)) | |
36 | 32 |
37 (autoload 'rfc2047-encode-string "rfc2047") | 33 (autoload 'rfc2047-encode-string "rfc2047") |
38 | 34 |
39 (defgroup sendmail nil | 35 (defgroup sendmail nil |
40 "Mail sending commands for Emacs." | 36 "Mail sending commands for Emacs." |
201 If nil, it will be initialized from the REPLYTO environment variable | 197 If nil, it will be initialized from the REPLYTO environment variable |
202 when you first send mail." | 198 when you first send mail." |
203 :type '(choice (const nil) string) | 199 :type '(choice (const nil) string) |
204 :group 'sendmail) | 200 :group 'sendmail) |
205 | 201 |
206 ;;;###autoload | |
207 (defcustom mail-alias-file nil | 202 (defcustom mail-alias-file nil |
208 "If non-nil, the name of a file to use instead of `/usr/lib/aliases'. | 203 "If non-nil, the name of a file to use instead of the sendmail default. |
209 This file defines aliases to be expanded by the mailer; this is a different | 204 This file defines aliases to be expanded by the mailer; this is a different |
210 feature from that of defining aliases in `.mailrc' to be expanded in Emacs. | 205 feature from that of defining aliases in `.mailrc' to be expanded in Emacs. |
211 This variable has no effect unless your system uses sendmail as its mailer." | 206 This variable has no effect unless your system uses sendmail as its mailer. |
212 :type '(choice (const nil) file) | 207 The default file is defined in sendmail's configuration file, e.g. |
208 `/etc/aliases'." | |
209 :type '(choice (const :tag "Sendmail default" nil) file) | |
213 :group 'sendmail) | 210 :group 'sendmail) |
214 | 211 |
215 ;;;###autoload | 212 ;;;###autoload |
216 (defcustom mail-personal-alias-file (purecopy "~/.mailrc") | 213 (defcustom mail-personal-alias-file (purecopy "~/.mailrc") |
217 "If non-nil, the name of the user's personal mail alias file. | 214 "If non-nil, the name of the user's personal mail alias file. |
431 It can contain newlines, and should end in one. It is inserted | 428 It can contain newlines, and should end in one. It is inserted |
432 before you edit the message, so you can edit or delete the lines." | 429 before you edit the message, so you can edit or delete the lines." |
433 :type '(choice (const nil) string) | 430 :type '(choice (const nil) string) |
434 :group 'sendmail) | 431 :group 'sendmail) |
435 | 432 |
436 ;; FIXME no need for autoload | |
437 ;;;###autoload | |
438 (defcustom mail-bury-selects-summary t | 433 (defcustom mail-bury-selects-summary t |
439 "If non-nil, try to show Rmail summary buffer after returning from mail. | 434 "If non-nil, try to show Rmail summary buffer after returning from mail. |
440 The functions \\[mail-send-on-exit] or \\[mail-dont-send] select | 435 The functions \\[mail-send-on-exit] or \\[mail-dont-send] select |
441 the Rmail summary buffer before returning, if it exists and this variable | 436 the Rmail summary buffer before returning, if it exists and this variable |
442 is non-nil." | 437 is non-nil." |
443 :type 'boolean | 438 :type 'boolean |
444 :group 'sendmail) | 439 :group 'sendmail) |
445 | 440 |
446 ;; FIXME no need for autoload | |
447 ;;;###autoload | |
448 (defcustom mail-send-nonascii 'mime | 441 (defcustom mail-send-nonascii 'mime |
449 "Specify whether to allow sending non-ASCII characters in mail. | 442 "Specify whether to allow sending non-ASCII characters in mail. |
450 If t, that means do allow it. nil means don't allow it. | 443 If t, that means do allow it. nil means don't allow it. |
451 `query' means ask the user each time. | 444 `query' means ask the user each time. |
452 `mime' means add an appropriate MIME header if none already present. | 445 `mime' means add an appropriate MIME header if none already present. |
466 (const :tag "Success" success))) | 459 (const :tag "Success" success))) |
467 :version "22.1") | 460 :version "22.1") |
468 | 461 |
469 ;; Note: could use /usr/ucb/mail instead of sendmail; | 462 ;; Note: could use /usr/ucb/mail instead of sendmail; |
470 ;; options -t, and -v if not interactive. | 463 ;; options -t, and -v if not interactive. |
471 (defvar mail-mailer-swallows-blank-line | 464 (defvar mail-mailer-swallows-blank-line nil |
472 (if (and (string-match "sparc-sun-sunos\\(\\'\\|[^5]\\)" system-configuration) | |
473 (file-readable-p "/etc/sendmail.cf") | |
474 (with-temp-buffer | |
475 (insert-file-contents "/etc/sendmail.cf") | |
476 (goto-char (point-min)) | |
477 (let ((case-fold-search nil)) | |
478 (re-search-forward "^OR\\>" nil t)))) | |
479 ;; According to RFC822, "The field-name must be composed of printable | |
480 ;; ASCII characters (i.e. characters that have decimal values between | |
481 ;; 33 and 126, except colon)", i.e. any chars except ctl chars, | |
482 ;; space, or colon. | |
483 '(looking-at "[ \t]\\|[][!\"#$%&'()*+,-./0-9;<=>?@A-Z\\\\^_`a-z{|}~]+:")) | |
484 "Set this non-nil if the system's mailer runs the header and body together. | 465 "Set this non-nil if the system's mailer runs the header and body together. |
485 \(This problem exists on Sunos 4 when sendmail is run in remote mode.) | 466 The actual value should be an expression to evaluate that returns |
486 The value should be an expression to test whether the problem will | 467 non-nil if the problem will actually occur. |
487 actually occur.") | 468 \(As far as we know, this is not an issue on any system still supported |
469 by Emacs.)") | |
470 | |
471 (put 'mail-mailer-swallows-blank-line 'risky-local-variable t) ; gets evalled | |
472 (make-obsolete-variable 'mail-mailer-swallows-blank-line | |
473 "no need to set this on any modern system." "24.1") | |
488 | 474 |
489 (defvar mail-mode-syntax-table | 475 (defvar mail-mode-syntax-table |
490 ;; define-derived-mode will make it inherit from text-mode-syntax-table. | 476 ;; define-derived-mode will make it inherit from text-mode-syntax-table. |
491 (let ((st (make-syntax-table))) | 477 (let ((st (make-syntax-table))) |
492 ;; FIXME this is probably very obsolete now ("percent hack"). | 478 ;; FIXME this is probably very obsolete now ("percent hack"). |
537 | 523 |
538 (defun mail-setup (to subject in-reply-to cc replybuffer actions) | 524 (defun mail-setup (to subject in-reply-to cc replybuffer actions) |
539 (or mail-default-reply-to | 525 (or mail-default-reply-to |
540 (setq mail-default-reply-to (getenv "REPLYTO"))) | 526 (setq mail-default-reply-to (getenv "REPLYTO"))) |
541 (sendmail-sync-aliases) | 527 (sendmail-sync-aliases) |
542 (if (eq mail-aliases t) | 528 (when (eq mail-aliases t) |
543 (progn | 529 (setq mail-aliases nil) |
544 (setq mail-aliases nil) | 530 (and mail-personal-alias-file |
545 (when mail-personal-alias-file | 531 (file-exists-p mail-personal-alias-file) |
546 (if (file-exists-p mail-personal-alias-file) | 532 (build-mail-aliases))) |
547 (build-mail-aliases))))) | |
548 ;; Don't leave this around from a previous message. | 533 ;; Don't leave this around from a previous message. |
549 (kill-local-variable 'buffer-file-coding-system) | 534 (kill-local-variable 'buffer-file-coding-system) |
550 ;; This doesn't work for enable-multibyte-characters. | 535 ;; This doesn't work for enable-multibyte-characters. |
551 ;; (kill-local-variable 'enable-multibyte-characters) | 536 ;; (kill-local-variable 'enable-multibyte-characters) |
552 (set-buffer-multibyte (default-value 'enable-multibyte-characters)) | 537 (set-buffer-multibyte (default-value 'enable-multibyte-characters)) |