diff options
| author | Gerd Moellmann | 1999-10-14 22:09:58 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 1999-10-14 22:09:58 +0000 |
| commit | e889eabcbab34250c09e72374387312cd621271d (patch) | |
| tree | bf17b2bf7c4d01b2cf2703fb5d1ab9cf18927eb9 | |
| parent | 85852dc7f5217e0361b38df5339e1589e40f5294 (diff) | |
| download | emacs-e889eabcbab34250c09e72374387312cd621271d.tar.gz emacs-e889eabcbab34250c09e72374387312cd621271d.zip | |
(smtpmail-via-smtp): Add support for
automatically appending a domain to RCPT TO: addresses.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/mail/smtpmail.el | 27 |
2 files changed, 31 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 01e3a4e19e7..ae1777aedb9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 1999-10-15 Gerd Moellmann <gerd@gnu.org> | ||
| 2 | |||
| 3 | * smtpmail.el (smtpmail-via-smtp): Add support for | ||
| 4 | automatically appending a domain to RCPT TO: addresses. | ||
| 5 | |||
| 1 | 1999-10-14 Richard M. Stallman <rms@caffeine.ai.mit.edu> | 6 | 1999-10-14 Richard M. Stallman <rms@caffeine.ai.mit.edu> |
| 2 | 7 | ||
| 3 | * dired.el (dired-insert-directory): Insert the amount of | 8 | * dired.el (dired-insert-directory): Insert the amount of |
diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el index 9b1ce021415..6f53489571b 100644 --- a/lisp/mail/smtpmail.el +++ b/lisp/mail/smtpmail.el | |||
| @@ -1,4 +1,6 @@ | |||
| 1 | ;;; smtpmail.el --- simple SMTP protocol (RFC 821) for sending mail | 1 | ;;; smtpmail.el --- simple SMTP protocol (RFC 821) for sending mail |
| 2 | ;;; ### Hacked by Mike Taylor, 11th October 1999 to add support for | ||
| 3 | ;;; automatically appending a domain to RCPT TO: addresses. | ||
| 2 | 4 | ||
| 3 | ;; Copyright (C) 1995, 1996 Free Software Foundation, Inc. | 5 | ;; Copyright (C) 1995, 1996 Free Software Foundation, Inc. |
| 4 | 6 | ||
| @@ -34,6 +36,7 @@ | |||
| 34 | ;;(setq message-send-mail-function 'smtpmail-send-it) ; if you use `message' | 36 | ;;(setq message-send-mail-function 'smtpmail-send-it) ; if you use `message' |
| 35 | ;;(setq smtpmail-default-smtp-server "YOUR SMTP HOST") | 37 | ;;(setq smtpmail-default-smtp-server "YOUR SMTP HOST") |
| 36 | ;;(setq smtpmail-local-domain "YOUR DOMAIN NAME") | 38 | ;;(setq smtpmail-local-domain "YOUR DOMAIN NAME") |
| 39 | ;;(setq smtpmail-sendto-domain "YOUR DOMAIN NAME") | ||
| 37 | ;;(setq smtpmail-debug-info t) ; only to debug problems | 40 | ;;(setq smtpmail-debug-info t) ; only to debug problems |
| 38 | 41 | ||
| 39 | ;; To queue mail, set smtpmail-queue-mail to t and use | 42 | ;; To queue mail, set smtpmail-queue-mail to t and use |
| @@ -74,6 +77,28 @@ don't define this value." | |||
| 74 | :type '(choice (const nil) string) | 77 | :type '(choice (const nil) string) |
| 75 | :group 'smtpmail) | 78 | :group 'smtpmail) |
| 76 | 79 | ||
| 80 | (defcustom smtpmail-sendto-domain nil | ||
| 81 | "*Local domain name without a host name. | ||
| 82 | This is appended (with an @-sign) to any specified recipients which do | ||
| 83 | not include an @-sign, so that each RCPT TO address is fully qualified. | ||
| 84 | \(Some configurations of sendmail require this.) | ||
| 85 | |||
| 86 | Don't bother to set this unless you have get an error like: | ||
| 87 | Sending failed; SMTP protocol error | ||
| 88 | when sending mail, and the *trace of SMTP session to <somewhere>* | ||
| 89 | buffer includes an exchange like: | ||
| 90 | RCPT TO: <someone> | ||
| 91 | 501 <someone>: recipient address must contain a domain | ||
| 92 | " | ||
| 93 | :type '(choice (const nil) string) | ||
| 94 | :group 'smtpmail) | ||
| 95 | |||
| 96 | (defun maybe-append-domain (recipient) | ||
| 97 | (if (or (not smtpmail-sendto-domain) | ||
| 98 | (string-match "@" recipient)) | ||
| 99 | recipient | ||
| 100 | (concat recipient "@" smtpmail-sendto-domain))) | ||
| 101 | |||
| 77 | (defcustom smtpmail-debug-info nil | 102 | (defcustom smtpmail-debug-info nil |
| 78 | "*smtpmail debug info printout. messages and process buffer." | 103 | "*smtpmail debug info printout. messages and process buffer." |
| 79 | :type 'boolean | 104 | :type 'boolean |
| @@ -448,7 +473,7 @@ This is relative to `smtpmail-queue-dir'.") | |||
| 448 | ;; RCPT TO: <recipient> | 473 | ;; RCPT TO: <recipient> |
| 449 | (let ((n 0)) | 474 | (let ((n 0)) |
| 450 | (while (not (null (nth n recipient))) | 475 | (while (not (null (nth n recipient))) |
| 451 | (smtpmail-send-command process (format "RCPT TO: <%s>" (nth n recipient))) | 476 | (smtpmail-send-command process (format "RCPT TO: <%s>" (maybe-append-domain (nth n recipient)))) |
| 452 | (setq n (1+ n)) | 477 | (setq n (1+ n)) |
| 453 | 478 | ||
| 454 | (setq response-code (smtpmail-read-response process)) | 479 | (setq response-code (smtpmail-read-response process)) |