Mercurial > emacs
changeset 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 | 33465d50a59c |
children | 256278052342 |
files | lisp/mail/smtpmail.el |
diffstat | 1 files changed, 26 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/mail/smtpmail.el Thu Oct 14 21:53:37 1999 +0000 +++ b/lisp/mail/smtpmail.el Thu Oct 14 22:09:02 1999 +0000 @@ -1,4 +1,6 @@ ;;; smtpmail.el --- simple SMTP protocol (RFC 821) for sending mail +;;; ### Hacked by Mike Taylor, 11th October 1999 to add support for +;;; automatically appending a domain to RCPT TO: addresses. ;; Copyright (C) 1995, 1996 Free Software Foundation, Inc. @@ -34,6 +36,7 @@ ;;(setq message-send-mail-function 'smtpmail-send-it) ; if you use `message' ;;(setq smtpmail-default-smtp-server "YOUR SMTP HOST") ;;(setq smtpmail-local-domain "YOUR DOMAIN NAME") +;;(setq smtpmail-sendto-domain "YOUR DOMAIN NAME") ;;(setq smtpmail-debug-info t) ; only to debug problems ;; To queue mail, set smtpmail-queue-mail to t and use @@ -74,6 +77,28 @@ :type '(choice (const nil) string) :group 'smtpmail) +(defcustom smtpmail-sendto-domain nil + "*Local domain name without a host name. +This is appended (with an @-sign) to any specified recipients which do +not include an @-sign, so that each RCPT TO address is fully qualified. +\(Some configurations of sendmail require this.) + +Don't bother to set this unless you have get an error like: + Sending failed; SMTP protocol error +when sending mail, and the *trace of SMTP session to <somewhere>* +buffer includes an exchange like: + RCPT TO: <someone> + 501 <someone>: recipient address must contain a domain +" + :type '(choice (const nil) string) + :group 'smtpmail) + +(defun maybe-append-domain (recipient) + (if (or (not smtpmail-sendto-domain) + (string-match "@" recipient)) + recipient + (concat recipient "@" smtpmail-sendto-domain))) + (defcustom smtpmail-debug-info nil "*smtpmail debug info printout. messages and process buffer." :type 'boolean @@ -448,7 +473,7 @@ ;; RCPT TO: <recipient> (let ((n 0)) (while (not (null (nth n recipient))) - (smtpmail-send-command process (format "RCPT TO: <%s>" (nth n recipient))) + (smtpmail-send-command process (format "RCPT TO: <%s>" (maybe-append-domain (nth n recipient)))) (setq n (1+ n)) (setq response-code (smtpmail-read-response process))