# HG changeset patch # User Gerd Moellmann # Date 939938942 0 # Node ID a0126ac842dc658593d071fc97382b344ef248b2 # Parent 33465d50a59c04858b7446c6dd24f88cedeaa532 (smtpmail-via-smtp): Add support for automatically appending a domain to RCPT TO: addresses. diff -r 33465d50a59c -r a0126ac842dc lisp/mail/smtpmail.el --- 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 * +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 @@ ;; 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))