bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Patch to smtpmail.el


From: Dewey Sasser
Subject: Patch to smtpmail.el
Date: Wed, 23 Jul 2003 15:25:50 -0400

Please include this patch to lisp/mail/smtpmail.el in the standard
emacs distribution.

Justification:

In conjunction with a patch to message.el (already submitted to the
Gnus team), this patch allows a user to make the variable
"smtpmail-smtp-server" buffer local and therefore easily control the
mail host through which mail is sent.

It is often desirable to send mail through different hosts when
dealing with multiple on-line "personalities" for privacy or
performance reasons.

----------------------------------------------------------------------
*** smtpmail.el.orig    Mon Dec 10 14:52:41 2001
--- smtpmail.el Wed Jul 23 11:01:54 2003
***************
*** 157,162 ****
--- 157,164 ----
      (unwind-protect
        (save-excursion
          (set-buffer tembuf)
+         ;; carry forward any local overrides of the smtp server
+         (smtpmail-clone-locals mailbuf)
          (erase-buffer)
          (insert-buffer-substring mailbuf)
          (goto-char (point-max))
***************
*** 345,350 ****
--- 347,355 ----
    (let ((process nil)
        (host (or smtpmail-smtp-server
                  (error "`smtpmail-smtp-server' not defined")))
+       ;; this might be a local override, so we don't want to pull it
+       ;; later when the process buffer is current 
+       (sender user-mail-address)
        (port smtpmail-smtp-service)
        response-code
        greeting
***************
*** 471,477 ****
                     "")))
  ;           (smtpmail-send-command process (format "MAIL FROM:address@hidden" 
(user-login-name) (smtpmail-fqdn)))
              (smtpmail-send-command process (format "MAIL FROM: <%s>%s%s"
!                                                    user-mail-address
                                                     size-part
                                                     body-part))
  
--- 476,482 ----
                     "")))
  ;           (smtpmail-send-command process (format "MAIL FROM:address@hidden" 
(user-login-name) (smtpmail-fqdn)))
              (smtpmail-send-command process (format "MAIL FROM: <%s>%s%s"
!                                                    sender
                                                     size-part
                                                     body-part))
  
***************
*** 726,731 ****
--- 731,761 ----
          (replace-match ""))))))
  
  
+ ;; method pretty much copied from Gnus's message.el because I doubt
+ ;; this file should depend on Gnus.
+ 
+ ;; Note:  I took out the copying of all the gnus variables.  Should I
+ ;; have?
+ 
+ (defun smtpmail-clone-locals (buffer &optional varstr)
+   "Clone the local variables from BUFFER to the current buffer."
+   (let ((locals (save-excursion
+                 (set-buffer buffer)
+                 (buffer-local-variables)))
+       (regexp "^smtpmail-\\|^user-mail-address"))
+     (mapcar
+      (lambda (local)
+        (when (and (consp local)
+                 (car local)
+                 (string-match regexp (symbol-name (car local)))
+                 (or (null varstr)
+                     (string-match varstr (symbol-name (car local)))))
+        (ignore-errors
+          (set (make-local-variable (car local))
+               (cdr local)))))
+      locals)))
+ 
+ 
  (provide 'smtpmail)
  
  ;;; smtpmail.el ends here
----------------------------------------------------------------------


-- 
Dewey Sasser
address@hidden
---
No question is so difficult to answer as that to which the answer is
obvious.  





reply via email to

[Prev in Thread] Current Thread [Next in Thread]