[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r104667: (smtpmail-via-smtp): Check f
From: |
Lars Magne Ingebrigtsen |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r104667: (smtpmail-via-smtp): Check for servers saying they want AUTH after MAIL FROM, too. |
Date: |
Wed, 22 Jun 2011 00:33:44 +0200 |
User-agent: |
Bazaar (2.3.1) |
------------------------------------------------------------
revno: 104667
committer: Lars Magne Ingebrigtsen <address@hidden>
branch nick: trunk
timestamp: Wed 2011-06-22 00:33:44 +0200
message:
(smtpmail-via-smtp): Check for servers saying they want AUTH after MAIL FROM,
too.
modified:
lisp/ChangeLog
lisp/mail/smtpmail.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2011-06-21 21:10:52 +0000
+++ b/lisp/ChangeLog 2011-06-21 22:33:44 +0000
@@ -6,6 +6,8 @@
but in particular:
(smtpmail-auth-credentials): Removed.
(smtpmail-starttls-credentials): Removed.
+ (smtpmail-via-smtp): Check for servers saying they want AUTH after
+ MAIL FROM, too.
* net/network-stream.el (network-stream-open-starttls): Provide
support for client certificates both for external and built-in
=== modified file 'lisp/mail/smtpmail.el'
--- a/lisp/mail/smtpmail.el 2011-06-21 21:10:52 +0000
+++ b/lisp/mail/smtpmail.el 2011-06-21 22:33:44 +0000
@@ -470,7 +470,9 @@
(smtpmail-send-command process string)
(unless (smtpmail-ok-p (setq ret (smtpmail-read-response process))
code)
- (throw 'done (smtpmail-response-text ret)))
+ (throw 'done (format "%s in response to %s"
+ (smtpmail-response-text ret)
+ string)))
ret))
(defun smtpmail-try-auth-methods (process supported-extensions host port
@@ -483,7 +485,9 @@
(auth-info (car
(auth-source-search :max 1
:host host
- :port (or port "smtp")
+ :port (if port
+ (format "%s" port)
+ "smtp")
:create ask-for-password)))
(user (plist-get auth-info :user))
(password (plist-get auth-info :secret))
@@ -721,9 +725,27 @@
" BODY=8BITMIME"
"")
"")))
- (smtpmail-command-or-throw
+ (smtpmail-send-command
process (format "MAIL FROM:<%s>%s%s"
- envelope-from size-part body-part)))
+ envelope-from size-part body-part))
+ (cond
+ ((smtpmail-ok-p (setq result (smtpmail-read-response process)))
+ ;; Success.
+ )
+ ((and auth-mechanisms
+ (not ask-for-password)
+ (= (car result) 530))
+ ;; We got a "530 auth required", so we close and try
+ ;; again, this time asking the user for a password.
+ (smtpmail-send-command process "QUIT")
+ (smtpmail-read-response process)
+ (delete-process process)
+ (throw 'done
+ (smtpmail-via-smtp recipient smtpmail-text-buffer t)))
+ (t
+ ;; Return the error code.
+ (throw 'done
+ (smtpmail-response-text result)))))
;; RCPT TO:<recipient>
(let ((n 0))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r104667: (smtpmail-via-smtp): Check for servers saying they want AUTH after MAIL FROM, too.,
Lars Magne Ingebrigtsen <=