comparison lisp/mail/smtpmail.el @ 64414:84d21f8fafbb

(smtpmail-auth-supported): Added the 'plain auth method (smtpmail-try-auth-methods): added the AUTH PLAIN dialog
author Simon Josefsson <jas@extundo.com>
date Sun, 17 Jul 2005 07:43:16 +0000
parents 18a818a2ee7c
children 3b19cfc14a51
comparison
equal deleted inserted replaced
64413:995d0baa8581 64414:84d21f8fafbb
1 ;;; smtpmail.el --- simple SMTP protocol (RFC 821) for sending mail 1 ;;; smtpmail.el --- simple SMTP protocol (RFC 821) for sending mail
2 2
3 ;; Copyright (C) 1995, 1996, 2001, 2002, 2003, 2004 3 ;; Copyright (C) 1995, 1996, 2001, 2002, 2003, 2004, 2005
4 ;; Free Software Foundation, Inc. 4 ;; Free Software Foundation, Inc.
5 5
6 ;; Author: Tomoji Kagatani <kagatani@rbc.ncl.omron.co.jp> 6 ;; Author: Tomoji Kagatani <kagatani@rbc.ncl.omron.co.jp>
7 ;; Maintainer: Simon Josefsson <simon@josefsson.org> 7 ;; Maintainer: Simon Josefsson <simon@josefsson.org>
8 ;; w32 Maintainer: Brian D. Carlstrom <bdc@ai.mit.edu> 8 ;; w32 Maintainer: Brian D. Carlstrom <bdc@ai.mit.edu>
205 (defvar smtpmail-read-point) 205 (defvar smtpmail-read-point)
206 206
207 (defvar smtpmail-queue-index (concat smtpmail-queue-dir 207 (defvar smtpmail-queue-index (concat smtpmail-queue-dir
208 smtpmail-queue-index-file)) 208 smtpmail-queue-index-file))
209 209
210 (defconst smtpmail-auth-supported '(cram-md5 login) 210 (defconst smtpmail-auth-supported '(cram-md5 login plain)
211 "List of supported SMTP AUTH mechanisms.") 211 "List of supported SMTP AUTH mechanisms.")
212 212
213 ;;; 213 ;;;
214 ;;; 214 ;;;
215 ;;; 215 ;;;
557 (smtpmail-send-command process (base64-encode-string passwd)) 557 (smtpmail-send-command process (base64-encode-string passwd))
558 (if (or (null (car (setq ret (smtpmail-read-response process)))) 558 (if (or (null (car (setq ret (smtpmail-read-response process))))
559 (not (integerp (car ret))) 559 (not (integerp (car ret)))
560 (>= (car ret) 400)) 560 (>= (car ret) 400))
561 (throw 'done nil))) 561 (throw 'done nil)))
562 ((eq mech 'plain)
563 (smtpmail-send-command process "AUTH PLAIN")
564 (if (or (null (car (setq ret (smtpmail-read-response process))))
565 (not (integerp (car ret)))
566 (not (equal (car ret) 334)))
567 (throw 'done nil))
568 (smtpmail-send-command process (base64-encode-string
569 (concat "\0"
570 (smtpmail-cred-user cred)
571 "\0"
572 (smtpmail-cred-passwd cred))))
573 (if (or (null (car (setq ret (smtpmail-read-response process))))
574 (not (integerp (car ret)))
575 (not (equal (car ret) 235)))
576 (throw 'done nil)))
577
562 (t 578 (t
563 (error "Mechanism %s not implemented" mech))) 579 (error "Mechanism %s not implemented" mech)))
564 ;; Remember the password. 580 ;; Remember the password.
565 (when (and (not (stringp smtpmail-auth-credentials)) 581 (when (and (not (stringp smtpmail-auth-credentials))
566 (null (smtpmail-cred-passwd cred))) 582 (null (smtpmail-cred-passwd cred)))
567 (setcar (cdr (cdr (cdr cred))) passwd))))) 583 (setcar (cdr (cdr (cdr cred))) passwd)))))
568 584