]> code.delx.au - gnu-emacs/blobdiff - lisp/mail/smtpmail.el
Comment (minor header format fix).
[gnu-emacs] / lisp / mail / smtpmail.el
index 3a5e8528c5f4d6ce79c2db24caa5b65c188978eb..76c6d42b6dc85f8a8f908d0c574e4f52e8cb3448 100644 (file)
@@ -1,7 +1,7 @@
 ;;; smtpmail.el --- simple SMTP protocol (RFC 821) for sending mail
 
-;; Copyright (C) 1995, 1996, 2001, 2002, 2003, 2004, 2005,
-;;   2006, 2007, 2008 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 1996, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+;;   2008, 2009  Free Software Foundation, Inc.
 
 ;; Author: Tomoji Kagatani <kagatani@rbc.ncl.omron.co.jp>
 ;; Maintainer: Simon Josefsson <simon@josefsson.org>
@@ -67,6 +67,7 @@
 ;;; Code:
 
 (require 'sendmail)
+(autoload 'starttls-any-program-available "starttls")
 (autoload 'starttls-open-stream "starttls")
 (autoload 'starttls-negotiate "starttls")
 (autoload 'mail-strip-quoted-names "mail-utils")
@@ -77,9 +78,7 @@
 (autoload 'netrc-machine "netrc")
 (autoload 'netrc-get "netrc")
 (autoload 'password-read "password-cache")
-
-(eval-and-compile
-  (autoload 'auth-source-user-or-password "auth-source"))
+(autoload 'auth-source-user-or-password "auth-source")
 
 ;;;
 (defgroup smtpmail nil
@@ -505,13 +504,7 @@ This is relative to `smtpmail-queue-dir'."
 (defun smtpmail-open-stream (process-buffer host port)
   (let ((cred (smtpmail-find-credentials
               smtpmail-starttls-credentials host port)))
-    (if (null (and cred (condition-case ()
-                           (with-no-warnings
-                             (require 'starttls)
-                             (call-process (if starttls-use-gnutls
-                                               starttls-gnutls-program
-                                             starttls-program)))
-                         (error nil))))
+    (if (null (and cred (starttls-any-program-available)))
        ;; The normal case.
        (open-network-stream "SMTP" process-buffer host port)
       (let* ((cred-key (smtpmail-cred-key cred))
@@ -542,9 +535,9 @@ This is relative to `smtpmail-queue-dir'."
 (defun smtpmail-try-auth-methods (process supported-extensions host port)
   (let* ((mechs (cdr-safe (assoc 'auth supported-extensions)))
         (mech (car (smtpmail-intersection smtpmail-auth-supported mechs)))
-        (auth-user (auth-source-user-or-password 
+        (auth-user (auth-source-user-or-password
                     "login" host (or port "smtp")))
-        (auth-pass (auth-source-user-or-password 
+        (auth-pass (auth-source-user-or-password
                     "password" host (or port "smtp")))
         (cred (if (and auth-user auth-pass) ; try user-auth-* before netrc-*
                   (list host port auth-user auth-pass)