From: Gerd Moellmann Date: Thu, 14 Oct 1999 22:09:58 +0000 (+0000) Subject: (smtpmail-via-smtp): Add support for X-Git-Tag: emacs-pretest-21.0.90~6433 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e889eabcbab34250c09e72374387312cd621271d;p=emacs.git (smtpmail-via-smtp): Add support for automatically appending a domain to RCPT TO: addresses. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 01e3a4e19e7..ae1777aedb9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +1999-10-15 Gerd Moellmann + + * smtpmail.el (smtpmail-via-smtp): Add support for + automatically appending a domain to RCPT TO: addresses. + 1999-10-14 Richard M. Stallman * 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 @@ ;;; 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 @@ don't define this value." :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 * +buffer includes an exchange like: + RCPT TO: + 501 : 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 @@ This is relative to `smtpmail-queue-dir'.") ;; RCPT TO: (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))