Mercurial > emacs
comparison lisp/mail/smtpmail.el @ 26028:a0126ac842dc
(smtpmail-via-smtp): Add support for
automatically appending a domain to RCPT TO: addresses.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Thu, 14 Oct 1999 22:09:02 +0000 |
parents | 45799f110d16 |
children | 595c23d107f8 |
comparison
equal
deleted
inserted
replaced
26027:33465d50a59c | 26028:a0126ac842dc |
---|---|
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 |
5 ;; Author: Tomoji Kagatani <kagatani@rbc.ncl.omron.co.jp> | 7 ;; Author: Tomoji Kagatani <kagatani@rbc.ncl.omron.co.jp> |
6 ;; Maintainer: Brian D. Carlstrom <bdc@ai.mit.edu> | 8 ;; Maintainer: Brian D. Carlstrom <bdc@ai.mit.edu> |
32 ;; | 34 ;; |
33 ;;(setq send-mail-function 'smtpmail-send-it) ; if you use `mail' | 35 ;;(setq send-mail-function 'smtpmail-send-it) ; if you use `mail' |
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 |
40 ;; smtpmail-send-queued-mail to send. | 43 ;; smtpmail-send-queued-mail to send. |
41 | 44 |
71 "*Local domain name without a host name. | 74 "*Local domain name without a host name. |
72 If the function (system-name) returns the full internet address, | 75 If the function (system-name) returns the full internet address, |
73 don't define this value." | 76 don't define this value." |
74 :type '(choice (const nil) string) | 77 :type '(choice (const nil) string) |
75 :group 'smtpmail) | 78 :group 'smtpmail) |
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))) | |
76 | 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 |
80 :group 'smtpmail) | 105 :group 'smtpmail) |
446 )) | 471 )) |
447 | 472 |
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)) |
455 (if (or (null (car response-code)) | 480 (if (or (null (car response-code)) |
456 (not (integerp (car response-code))) | 481 (not (integerp (car response-code))) |