Mercurial > emacs
annotate lisp/mail/smtpmail.el @ 55283:0c58eb7225cd
(clean mostlyclean): Fix previous change.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Sat, 01 May 2004 05:02:57 +0000 |
parents | 63ed691cfee6 |
children | a4b0f825c65a |
rev | line source |
---|---|
17517 | 1 ;;; smtpmail.el --- simple SMTP protocol (RFC 821) for sending mail |
15345 | 2 |
54763
63ed691cfee6
Add comment, based on report by kdc@rcn.com (Kevin D. Clark).
Simon Josefsson <jas@extundo.com>
parents:
54350
diff
changeset
|
3 ;; Copyright (C) 1995, 1996, 2001, 2002, 2003, 2004 |
63ed691cfee6
Add comment, based on report by kdc@rcn.com (Kevin D. Clark).
Simon Josefsson <jas@extundo.com>
parents:
54350
diff
changeset
|
4 ;; Free Software Foundation, Inc. |
15345 | 5 |
6 ;; Author: Tomoji Kagatani <kagatani@rbc.ncl.omron.co.jp> | |
41221
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
7 ;; Maintainer: Simon Josefsson <simon@josefsson.org> |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
8 ;; w32 Maintainer: Brian D. Carlstrom <bdc@ai.mit.edu> |
18092
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
9 ;; ESMTP support: Simon Leinen <simon@switch.ch> |
37800
9cddd888d25f
(maybe-append-domain): Renamed to
Gerd Moellmann <gerd@gnu.org>
parents:
37600
diff
changeset
|
10 ;; Hacked by Mike Taylor, 11th October 1999 to add support for |
9cddd888d25f
(maybe-append-domain): Renamed to
Gerd Moellmann <gerd@gnu.org>
parents:
37600
diff
changeset
|
11 ;; automatically appending a domain to RCPT TO: addresses. |
41221
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
12 ;; AUTH=LOGIN support: Stephen Cranefield <scranefield@infoscience.otago.ac.nz> |
15345 | 13 ;; Keywords: mail |
14 | |
15 ;; This file is part of GNU Emacs. | |
16 | |
17 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
18 ;; it under the terms of the GNU General Public License as published by | |
19 ;; the Free Software Foundation; either version 2, or (at your option) | |
20 ;; any later version. | |
21 | |
22 ;; GNU Emacs is distributed in the hope that it will be useful, | |
23 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
24 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
25 ;; GNU General Public License for more details. | |
26 | |
27 ;; You should have received a copy of the GNU General Public License | |
28 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
29 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
30 ;; Boston, MA 02111-1307, USA. | |
31 | |
32 ;;; Commentary: | |
33 | |
34 ;; Send Mail to smtp host from smtpmail temp buffer. | |
35 | |
23142
98c430cac424
(smtpmail-send-it): Add autoload cookie.
Karl Heuer <kwzh@gnu.org>
parents:
22037
diff
changeset
|
36 ;; Please add these lines in your .emacs(_emacs) or use customize. |
15345 | 37 ;; |
23142
98c430cac424
(smtpmail-send-it): Add autoload cookie.
Karl Heuer <kwzh@gnu.org>
parents:
22037
diff
changeset
|
38 ;;(setq send-mail-function 'smtpmail-send-it) ; if you use `mail' |
44864
c18dd95f6962
(smtpmail-queue-counter): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
42225
diff
changeset
|
39 ;;(setq message-send-mail-function 'smtpmail-send-it) ; if you use message/Gnus |
15345 | 40 ;;(setq smtpmail-default-smtp-server "YOUR SMTP HOST") |
41 ;;(setq smtpmail-local-domain "YOUR DOMAIN NAME") | |
26028
a0126ac842dc
(smtpmail-via-smtp): Add support for
Gerd Moellmann <gerd@gnu.org>
parents:
24871
diff
changeset
|
42 ;;(setq smtpmail-sendto-domain "YOUR DOMAIN NAME") |
23142
98c430cac424
(smtpmail-send-it): Add autoload cookie.
Karl Heuer <kwzh@gnu.org>
parents:
22037
diff
changeset
|
43 ;;(setq smtpmail-debug-info t) ; only to debug problems |
44868
865b7fdda4bb
(smtpmail-auth-credentials): Support netrc files as well.
Richard M. Stallman <rms@gnu.org>
parents:
44864
diff
changeset
|
44 ;;(setq smtpmail-auth-credentials ; or use ~/.authinfo |
41221
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
45 ;; '(("YOUR SMTP HOST" 25 "username" "password"))) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
46 ;;(setq smtpmail-starttls-credentials |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
47 ;; '(("YOUR SMTP HOST" 25 "~/.my_smtp_tls.key" "~/.my_smtp_tls.cert"))) |
54763
63ed691cfee6
Add comment, based on report by kdc@rcn.com (Kevin D. Clark).
Simon Josefsson <jas@extundo.com>
parents:
54350
diff
changeset
|
48 ;; Where the 25 equals the value of `smtpmail-smtp-service', it can be an |
63ed691cfee6
Add comment, based on report by kdc@rcn.com (Kevin D. Clark).
Simon Josefsson <jas@extundo.com>
parents:
54350
diff
changeset
|
49 ;; integer or a string, just as long as they match (eq). |
15345 | 50 |
44883
7d867b33aa2d
(smtpmail-try-auth-methods): host is not in the authinfo/netrc => cred=nil.
Sam Steingold <sds@gnu.org>
parents:
44868
diff
changeset
|
51 ;; To queue mail, set smtpmail-queue-mail to t and use |
18094 | 52 ;; smtpmail-send-queued-mail to send. |
53 | |
41221
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
54 ;; Modified by Stephen Cranefield <scranefield@infoscience.otago.ac.nz>, |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
55 ;; 22/6/99, to support SMTP Authentication by the AUTH=LOGIN mechanism. |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
56 ;; See http://help.netscape.com/products/server/messaging/3x/info/smtpauth.html |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
57 ;; Rewritten by Simon Josefsson to use same credential variable as AUTH |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
58 ;; support below. |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
59 |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
60 ;; Modified by Simon Josefsson <jas@pdc.kth.se>, 22/2/99, to support SMTP |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
61 ;; Authentication by the AUTH mechanism. |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
62 ;; See http://www.ietf.org/rfc/rfc2554.txt |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
63 |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
64 ;; Modified by Simon Josefsson <simon@josefsson.org>, 2000-10-07, to support |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
65 ;; STARTTLS. Requires external program |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
66 ;; ftp://ftp.opaopa.org/pub/elisp/starttls-*.tar.gz. |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
67 ;; See http://www.ietf.org/rfc/rfc2246.txt, http://www.ietf.org/rfc/rfc2487.txt |
18094 | 68 |
15345 | 69 ;;; Code: |
70 | |
71 (require 'sendmail) | |
41221
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
72 (autoload 'starttls-open-stream "starttls") |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
73 (autoload 'starttls-negotiate "starttls") |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
74 (autoload 'mail-strip-quoted-names "mail-utils") |
41716
e467d0e8f243
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41497
diff
changeset
|
75 (autoload 'message-make-date "message") |
e467d0e8f243
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41497
diff
changeset
|
76 (autoload 'message-make-message-id "message") |
41221
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
77 (autoload 'rfc2104-hash "rfc2104") |
44868
865b7fdda4bb
(smtpmail-auth-credentials): Support netrc files as well.
Richard M. Stallman <rms@gnu.org>
parents:
44864
diff
changeset
|
78 (autoload 'netrc-parse "netrc") |
45179
6ff2c20da16e
(netrc-machine, netrc-get): Add autoloads.
Richard M. Stallman <rms@gnu.org>
parents:
44883
diff
changeset
|
79 (autoload 'netrc-machine "netrc") |
6ff2c20da16e
(netrc-machine, netrc-get): Add autoloads.
Richard M. Stallman <rms@gnu.org>
parents:
44883
diff
changeset
|
80 (autoload 'netrc-get "netrc") |
15345 | 81 |
82 ;;; | |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16907
diff
changeset
|
83 (defgroup smtpmail nil |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16907
diff
changeset
|
84 "SMTP protocol for sending mail." |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16907
diff
changeset
|
85 :group 'mail) |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16907
diff
changeset
|
86 |
15345 | 87 |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16907
diff
changeset
|
88 (defcustom smtpmail-default-smtp-server nil |
47396
d7fa9253971f
(smtpmail-default-smtp-server): Doc fix.
Simon Josefsson <jas@extundo.com>
parents:
47225
diff
changeset
|
89 "*Specify default SMTP server. |
d7fa9253971f
(smtpmail-default-smtp-server): Doc fix.
Simon Josefsson <jas@extundo.com>
parents:
47225
diff
changeset
|
90 This only has effect if you specify it before loading the smtpmail library." |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16907
diff
changeset
|
91 :type '(choice (const nil) string) |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16907
diff
changeset
|
92 :group 'smtpmail) |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16907
diff
changeset
|
93 |
44883
7d867b33aa2d
(smtpmail-try-auth-methods): host is not in the authinfo/netrc => cred=nil.
Sam Steingold <sds@gnu.org>
parents:
44868
diff
changeset
|
94 (defcustom smtpmail-smtp-server |
15451
89c1e7fe879a
(smtpmail-smtp-service): Use port 25 as default.
Richard M. Stallman <rms@gnu.org>
parents:
15372
diff
changeset
|
95 (or (getenv "SMTPSERVER") smtpmail-default-smtp-server) |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16907
diff
changeset
|
96 "*The name of the host running SMTP server." |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16907
diff
changeset
|
97 :type '(choice (const nil) string) |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16907
diff
changeset
|
98 :group 'smtpmail) |
15345 | 99 |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16907
diff
changeset
|
100 (defcustom smtpmail-smtp-service 25 |
41221
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
101 "*SMTP service port number. |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
102 The default value would be \"smtp\" or 25 ." |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
103 :type '(choice (integer :tag "Port") (string :tag "Service")) |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16907
diff
changeset
|
104 :group 'smtpmail) |
15345 | 105 |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16907
diff
changeset
|
106 (defcustom smtpmail-local-domain nil |
15345 | 107 "*Local domain name without a host name. |
108 If the function (system-name) returns the full internet address, | |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16907
diff
changeset
|
109 don't define this value." |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16907
diff
changeset
|
110 :type '(choice (const nil) string) |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16907
diff
changeset
|
111 :group 'smtpmail) |
15345 | 112 |
26028
a0126ac842dc
(smtpmail-via-smtp): Add support for
Gerd Moellmann <gerd@gnu.org>
parents:
24871
diff
changeset
|
113 (defcustom smtpmail-sendto-domain nil |
a0126ac842dc
(smtpmail-via-smtp): Add support for
Gerd Moellmann <gerd@gnu.org>
parents:
24871
diff
changeset
|
114 "*Local domain name without a host name. |
a0126ac842dc
(smtpmail-via-smtp): Add support for
Gerd Moellmann <gerd@gnu.org>
parents:
24871
diff
changeset
|
115 This is appended (with an @-sign) to any specified recipients which do |
a0126ac842dc
(smtpmail-via-smtp): Add support for
Gerd Moellmann <gerd@gnu.org>
parents:
24871
diff
changeset
|
116 not include an @-sign, so that each RCPT TO address is fully qualified. |
a0126ac842dc
(smtpmail-via-smtp): Add support for
Gerd Moellmann <gerd@gnu.org>
parents:
24871
diff
changeset
|
117 \(Some configurations of sendmail require this.) |
a0126ac842dc
(smtpmail-via-smtp): Add support for
Gerd Moellmann <gerd@gnu.org>
parents:
24871
diff
changeset
|
118 |
a0126ac842dc
(smtpmail-via-smtp): Add support for
Gerd Moellmann <gerd@gnu.org>
parents:
24871
diff
changeset
|
119 Don't bother to set this unless you have get an error like: |
a0126ac842dc
(smtpmail-via-smtp): Add support for
Gerd Moellmann <gerd@gnu.org>
parents:
24871
diff
changeset
|
120 Sending failed; SMTP protocol error |
a0126ac842dc
(smtpmail-via-smtp): Add support for
Gerd Moellmann <gerd@gnu.org>
parents:
24871
diff
changeset
|
121 when sending mail, and the *trace of SMTP session to <somewhere>* |
a0126ac842dc
(smtpmail-via-smtp): Add support for
Gerd Moellmann <gerd@gnu.org>
parents:
24871
diff
changeset
|
122 buffer includes an exchange like: |
a0126ac842dc
(smtpmail-via-smtp): Add support for
Gerd Moellmann <gerd@gnu.org>
parents:
24871
diff
changeset
|
123 RCPT TO: <someone> |
a0126ac842dc
(smtpmail-via-smtp): Add support for
Gerd Moellmann <gerd@gnu.org>
parents:
24871
diff
changeset
|
124 501 <someone>: recipient address must contain a domain |
a0126ac842dc
(smtpmail-via-smtp): Add support for
Gerd Moellmann <gerd@gnu.org>
parents:
24871
diff
changeset
|
125 " |
a0126ac842dc
(smtpmail-via-smtp): Add support for
Gerd Moellmann <gerd@gnu.org>
parents:
24871
diff
changeset
|
126 :type '(choice (const nil) string) |
a0126ac842dc
(smtpmail-via-smtp): Add support for
Gerd Moellmann <gerd@gnu.org>
parents:
24871
diff
changeset
|
127 :group 'smtpmail) |
a0126ac842dc
(smtpmail-via-smtp): Add support for
Gerd Moellmann <gerd@gnu.org>
parents:
24871
diff
changeset
|
128 |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16907
diff
changeset
|
129 (defcustom smtpmail-debug-info nil |
41221
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
130 "Whether to print info in buffer *trace of SMTP session to <somewhere>*. |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
131 See also `smtpmail-debug-verb' which determines if the SMTP protocol should |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
132 be verbose as well." |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
133 :type 'boolean |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
134 :group 'smtpmail) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
135 |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
136 (defcustom smtpmail-debug-verb nil |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
137 "Whether this library sends the SMTP VERB command or not. |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
138 The commands enables verbose information from the SMTP server." |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16907
diff
changeset
|
139 :type 'boolean |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16907
diff
changeset
|
140 :group 'smtpmail) |
15345 | 141 |
17436
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16907
diff
changeset
|
142 (defcustom smtpmail-code-conv-from nil ;; *junet* |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16907
diff
changeset
|
143 "*smtpmail code convert from this code to *internal*..for tiny-mime.." |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16907
diff
changeset
|
144 :type 'boolean |
2a9fdbfcb993
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16907
diff
changeset
|
145 :group 'smtpmail) |
15345 | 146 |
44883
7d867b33aa2d
(smtpmail-try-auth-methods): host is not in the authinfo/netrc => cred=nil.
Sam Steingold <sds@gnu.org>
parents:
44868
diff
changeset
|
147 (defcustom smtpmail-queue-mail nil |
18094 | 148 "*Specify if mail is queued (if t) or sent immediately (if nil). |
149 If queued, it is stored in the directory `smtpmail-queue-dir' | |
150 and sent with `smtpmail-send-queued-mail'." | |
151 :type 'boolean | |
152 :group 'smtpmail) | |
153 | |
154 (defcustom smtpmail-queue-dir "~/Mail/queued-mail/" | |
155 "*Directory where `smtpmail.el' stores queued mail." | |
156 :type 'directory | |
157 :group 'smtpmail) | |
158 | |
44868
865b7fdda4bb
(smtpmail-auth-credentials): Support netrc files as well.
Richard M. Stallman <rms@gnu.org>
parents:
44864
diff
changeset
|
159 (defcustom smtpmail-auth-credentials "~/.authinfo" |
865b7fdda4bb
(smtpmail-auth-credentials): Support netrc files as well.
Richard M. Stallman <rms@gnu.org>
parents:
44864
diff
changeset
|
160 "Specify username and password for servers, directly or via .netrc file. |
865b7fdda4bb
(smtpmail-auth-credentials): Support netrc files as well.
Richard M. Stallman <rms@gnu.org>
parents:
44864
diff
changeset
|
161 This variable can either be a filename pointing to a file in netrc(5) |
865b7fdda4bb
(smtpmail-auth-credentials): Support netrc files as well.
Richard M. Stallman <rms@gnu.org>
parents:
44864
diff
changeset
|
162 format, or list of four-element lists that contain, in order, |
41221
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
163 `servername' (a string), `port' (an integer), `user' (a string) and |
44868
865b7fdda4bb
(smtpmail-auth-credentials): Support netrc files as well.
Richard M. Stallman <rms@gnu.org>
parents:
44864
diff
changeset
|
164 `password' (a string, or nil to query the user when needed). If you |
865b7fdda4bb
(smtpmail-auth-credentials): Support netrc files as well.
Richard M. Stallman <rms@gnu.org>
parents:
44864
diff
changeset
|
165 need to enter a `realm' too, add it to the user string, so that it |
865b7fdda4bb
(smtpmail-auth-credentials): Support netrc files as well.
Richard M. Stallman <rms@gnu.org>
parents:
44864
diff
changeset
|
166 looks like `user@realm'." |
865b7fdda4bb
(smtpmail-auth-credentials): Support netrc files as well.
Richard M. Stallman <rms@gnu.org>
parents:
44864
diff
changeset
|
167 :type '(choice file |
865b7fdda4bb
(smtpmail-auth-credentials): Support netrc files as well.
Richard M. Stallman <rms@gnu.org>
parents:
44864
diff
changeset
|
168 (repeat (list (string :tag "Server") |
41221
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
169 (integer :tag "Port") |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
170 (string :tag "Username") |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
171 (choice (const :tag "Query when needed" nil) |
44868
865b7fdda4bb
(smtpmail-auth-credentials): Support netrc files as well.
Richard M. Stallman <rms@gnu.org>
parents:
44864
diff
changeset
|
172 (string :tag "Password"))))) |
45204
a025c8bb9569
(smtpmail-send-it): Use user-mail-address from
Simon Josefsson <jas@extundo.com>
parents:
45179
diff
changeset
|
173 :version "21.4" |
41221
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
174 :group 'smtpmail) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
175 |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
176 (defcustom smtpmail-starttls-credentials '(("" 25 "" "")) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
177 "Specify STARTTLS keys and certificates for servers. |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
178 This is a list of four-element list with `servername' (a string), |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
179 `port' (an integer), `key' (a filename) and `certificate' (a filename)." |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
180 :type '(repeat (list (string :tag "Server") |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
181 (integer :tag "Port") |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
182 (file :tag "Key") |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
183 (file :tag "Certificate"))) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
184 :version "21.1" |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
185 :group 'smtpmail) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
186 |
37598
595c23d107f8
(smtpmail-warn-about-unknown-extensions): New
Gerd Moellmann <gerd@gnu.org>
parents:
26028
diff
changeset
|
187 (defcustom smtpmail-warn-about-unknown-extensions nil |
595c23d107f8
(smtpmail-warn-about-unknown-extensions): New
Gerd Moellmann <gerd@gnu.org>
parents:
26028
diff
changeset
|
188 "*If set, print warnings about unknown SMTP extensions. |
595c23d107f8
(smtpmail-warn-about-unknown-extensions): New
Gerd Moellmann <gerd@gnu.org>
parents:
26028
diff
changeset
|
189 This is mainly useful for development purposes, to learn about |
595c23d107f8
(smtpmail-warn-about-unknown-extensions): New
Gerd Moellmann <gerd@gnu.org>
parents:
26028
diff
changeset
|
190 new SMTP extensions that might be useful to support." |
595c23d107f8
(smtpmail-warn-about-unknown-extensions): New
Gerd Moellmann <gerd@gnu.org>
parents:
26028
diff
changeset
|
191 :type 'boolean |
37600
20c37aac51cd
(smtpmail-warn-about-unknown-extensions): Add :version.
Gerd Moellmann <gerd@gnu.org>
parents:
37598
diff
changeset
|
192 :version "21.1" |
37598
595c23d107f8
(smtpmail-warn-about-unknown-extensions): New
Gerd Moellmann <gerd@gnu.org>
parents:
26028
diff
changeset
|
193 :group 'smtpmail) |
595c23d107f8
(smtpmail-warn-about-unknown-extensions): New
Gerd Moellmann <gerd@gnu.org>
parents:
26028
diff
changeset
|
194 |
18094 | 195 (defvar smtpmail-queue-index-file "index" |
196 "File name of queued mail index, | |
197 This is relative to `smtpmail-queue-dir'.") | |
198 | |
23444
a632871d7cfa
(smtpmail-send-data-1): Use encode-coding-string.
Richard M. Stallman <rms@gnu.org>
parents:
23181
diff
changeset
|
199 (defvar smtpmail-address-buffer) |
a632871d7cfa
(smtpmail-send-data-1): Use encode-coding-string.
Richard M. Stallman <rms@gnu.org>
parents:
23181
diff
changeset
|
200 (defvar smtpmail-recipient-address-list) |
a632871d7cfa
(smtpmail-send-data-1): Use encode-coding-string.
Richard M. Stallman <rms@gnu.org>
parents:
23181
diff
changeset
|
201 |
44864
c18dd95f6962
(smtpmail-queue-counter): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
42225
diff
changeset
|
202 (defvar smtpmail-queue-counter 0) |
c18dd95f6962
(smtpmail-queue-counter): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
42225
diff
changeset
|
203 |
23444
a632871d7cfa
(smtpmail-send-data-1): Use encode-coding-string.
Richard M. Stallman <rms@gnu.org>
parents:
23181
diff
changeset
|
204 ;; Buffer-local variable. |
a632871d7cfa
(smtpmail-send-data-1): Use encode-coding-string.
Richard M. Stallman <rms@gnu.org>
parents:
23181
diff
changeset
|
205 (defvar smtpmail-read-point) |
a632871d7cfa
(smtpmail-send-data-1): Use encode-coding-string.
Richard M. Stallman <rms@gnu.org>
parents:
23181
diff
changeset
|
206 |
18094 | 207 (defvar smtpmail-queue-index (concat smtpmail-queue-dir |
208 smtpmail-queue-index-file)) | |
209 | |
41221
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
210 (defconst smtpmail-auth-supported '(cram-md5 login) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
211 "List of supported SMTP AUTH mechanisms.") |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
212 |
15345 | 213 ;;; |
214 ;;; | |
215 ;;; | |
216 | |
45252
ee1b06064fbb
(smtpmail-mail-address): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
45204
diff
changeset
|
217 (defvar smtpmail-mail-address nil |
52321
e4b050573b12
(smtpmail-mail-address): Doc change.
Glenn Morris <rgm@gnu.org>
parents:
51895
diff
changeset
|
218 "Value to use for envelope-from address for mail from ambient buffer.") |
45252
ee1b06064fbb
(smtpmail-mail-address): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
45204
diff
changeset
|
219 |
23142
98c430cac424
(smtpmail-send-it): Add autoload cookie.
Karl Heuer <kwzh@gnu.org>
parents:
22037
diff
changeset
|
220 ;;;###autoload |
15345 | 221 (defun smtpmail-send-it () |
222 (let ((errbuf (if mail-interactive | |
223 (generate-new-buffer " smtpmail errors") | |
224 0)) | |
225 (tembuf (generate-new-buffer " smtpmail temp")) | |
226 (case-fold-search nil) | |
227 delimline | |
24773 | 228 (mailbuf (current-buffer)) |
52347 | 229 ;; Examine this variable now, so that |
230 ;; local binding in the mail buffer will take effect. | |
52321
e4b050573b12
(smtpmail-mail-address): Doc change.
Glenn Morris <rgm@gnu.org>
parents:
51895
diff
changeset
|
231 (smtpmail-mail-address |
e4b050573b12
(smtpmail-mail-address): Doc change.
Glenn Morris <rgm@gnu.org>
parents:
51895
diff
changeset
|
232 (or (and mail-specify-envelope-from (mail-envelope-from)) |
e4b050573b12
(smtpmail-mail-address): Doc change.
Glenn Morris <rgm@gnu.org>
parents:
51895
diff
changeset
|
233 user-mail-address)) |
24773 | 234 (smtpmail-code-conv-from |
235 (if enable-multibyte-characters | |
236 (let ((sendmail-coding-system smtpmail-code-conv-from)) | |
237 (select-message-coding-system))))) | |
15345 | 238 (unwind-protect |
239 (save-excursion | |
240 (set-buffer tembuf) | |
241 (erase-buffer) | |
242 (insert-buffer-substring mailbuf) | |
243 (goto-char (point-max)) | |
244 ;; require one newline at the end. | |
245 (or (= (preceding-char) ?\n) | |
246 (insert ?\n)) | |
247 ;; Change header-delimiter to be what sendmail expects. | |
21862
c0569fcdef88
(smtpmail-send-it): Use mail-sendmail-undelimit-header.
Richard M. Stallman <rms@gnu.org>
parents:
21683
diff
changeset
|
248 (mail-sendmail-undelimit-header) |
15345 | 249 (setq delimline (point-marker)) |
15451
89c1e7fe879a
(smtpmail-smtp-service): Use port 25 as default.
Richard M. Stallman <rms@gnu.org>
parents:
15372
diff
changeset
|
250 ;; (sendmail-synch-aliases) |
15345 | 251 (if mail-aliases |
252 (expand-mail-aliases (point-min) delimline)) | |
253 (goto-char (point-min)) | |
254 ;; ignore any blank lines in the header | |
255 (while (and (re-search-forward "\n\n\n*" delimline t) | |
256 (< (point) delimline)) | |
257 (replace-match "\n")) | |
258 (let ((case-fold-search t)) | |
21683
dfb671ba22f8
(smtpmail-send-it): Deleted all code related to Resent-To: processing.
Richard M. Stallman <rms@gnu.org>
parents:
20058
diff
changeset
|
259 ;; We used to process Resent-... headers here, |
dfb671ba22f8
(smtpmail-send-it): Deleted all code related to Resent-To: processing.
Richard M. Stallman <rms@gnu.org>
parents:
20058
diff
changeset
|
260 ;; but it was not done properly, and the job |
dfb671ba22f8
(smtpmail-send-it): Deleted all code related to Resent-To: processing.
Richard M. Stallman <rms@gnu.org>
parents:
20058
diff
changeset
|
261 ;; is done correctly in smtpmail-deduce-address-list. |
15345 | 262 ;; Don't send out a blank subject line |
263 (goto-char (point-min)) | |
21683
dfb671ba22f8
(smtpmail-send-it): Deleted all code related to Resent-To: processing.
Richard M. Stallman <rms@gnu.org>
parents:
20058
diff
changeset
|
264 (if (re-search-forward "^Subject:\\([ \t]*\n\\)+\\b" delimline t) |
dfb671ba22f8
(smtpmail-send-it): Deleted all code related to Resent-To: processing.
Richard M. Stallman <rms@gnu.org>
parents:
20058
diff
changeset
|
265 (replace-match "") |
dfb671ba22f8
(smtpmail-send-it): Deleted all code related to Resent-To: processing.
Richard M. Stallman <rms@gnu.org>
parents:
20058
diff
changeset
|
266 ;; This one matches a Subject just before the header delimiter. |
dfb671ba22f8
(smtpmail-send-it): Deleted all code related to Resent-To: processing.
Richard M. Stallman <rms@gnu.org>
parents:
20058
diff
changeset
|
267 (if (and (re-search-forward "^Subject:\\([ \t]*\n\\)+" delimline t) |
dfb671ba22f8
(smtpmail-send-it): Deleted all code related to Resent-To: processing.
Richard M. Stallman <rms@gnu.org>
parents:
20058
diff
changeset
|
268 (= (match-end 0) delimline)) |
dfb671ba22f8
(smtpmail-send-it): Deleted all code related to Resent-To: processing.
Richard M. Stallman <rms@gnu.org>
parents:
20058
diff
changeset
|
269 (replace-match ""))) |
15452
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
270 ;; Put the "From:" field in unless for some odd reason |
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
271 ;; they put one in themselves. |
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
272 (goto-char (point-min)) |
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
273 (if (not (re-search-forward "^From:" delimline t)) |
45252
ee1b06064fbb
(smtpmail-mail-address): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
45204
diff
changeset
|
274 (let* ((login smtpmail-mail-address) |
15452
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
275 (fullname (user-full-name))) |
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
276 (cond ((eq mail-from-style 'angles) |
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
277 (insert "From: " fullname) |
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
278 (let ((fullname-start (+ (point-min) 6)) |
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
279 (fullname-end (point-marker))) |
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
280 (goto-char fullname-start) |
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
281 ;; Look for a character that cannot appear unquoted |
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
282 ;; according to RFC 822. |
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
283 (if (re-search-forward "[^- !#-'*+/-9=?A-Z^-~]" |
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
284 fullname-end 1) |
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
285 (progn |
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
286 ;; Quote fullname, escaping specials. |
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
287 (goto-char fullname-start) |
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
288 (insert "\"") |
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
289 (while (re-search-forward "[\"\\]" |
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
290 fullname-end 1) |
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
291 (replace-match "\\\\\\&" t)) |
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
292 (insert "\"")))) |
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
293 (insert " <" login ">\n")) |
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
294 ((eq mail-from-style 'parens) |
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
295 (insert "From: " login " (") |
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
296 (let ((fullname-start (point))) |
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
297 (insert fullname) |
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
298 (let ((fullname-end (point-marker))) |
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
299 (goto-char fullname-start) |
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
300 ;; RFC 822 says \ and nonmatching parentheses |
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
301 ;; must be escaped in comments. |
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
302 ;; Escape every instance of ()\ ... |
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
303 (while (re-search-forward "[()\\]" fullname-end 1) |
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
304 (replace-match "\\\\\\&" t)) |
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
305 ;; ... then undo escaping of matching parentheses, |
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
306 ;; including matching nested parentheses. |
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
307 (goto-char fullname-start) |
44883
7d867b33aa2d
(smtpmail-try-auth-methods): host is not in the authinfo/netrc => cred=nil.
Sam Steingold <sds@gnu.org>
parents:
44868
diff
changeset
|
308 (while (re-search-forward |
15452
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
309 "\\(\\=\\|[^\\]\\(\\\\\\\\\\)*\\)\\\\(\\(\\([^\\]\\|\\\\\\\\\\)*\\)\\\\)" |
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
310 fullname-end 1) |
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
311 (replace-match "\\1(\\3)" t) |
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
312 (goto-char fullname-start)))) |
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
313 (insert ")\n")) |
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
314 ((null mail-from-style) |
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
315 (insert "From: " login "\n"))))) |
41716
e467d0e8f243
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41497
diff
changeset
|
316 ;; Insert a `Message-Id:' field if there isn't one yet. |
e467d0e8f243
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41497
diff
changeset
|
317 (goto-char (point-min)) |
e467d0e8f243
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41497
diff
changeset
|
318 (unless (re-search-forward "^Message-Id:" delimline t) |
e467d0e8f243
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41497
diff
changeset
|
319 (insert "Message-Id: " (message-make-message-id) "\n")) |
e467d0e8f243
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41497
diff
changeset
|
320 ;; Insert a `Date:' field if there isn't one yet. |
e467d0e8f243
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41497
diff
changeset
|
321 (goto-char (point-min)) |
e467d0e8f243
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41497
diff
changeset
|
322 (unless (re-search-forward "^Date:" delimline t) |
e467d0e8f243
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41497
diff
changeset
|
323 (insert "Date: " (message-make-date) "\n")) |
15345 | 324 ;; Insert an extra newline if we need it to work around |
325 ;; Sun's bug that swallows newlines. | |
326 (goto-char (1+ delimline)) | |
327 (if (eval mail-mailer-swallows-blank-line) | |
328 (newline)) | |
15452
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
329 ;; Find and handle any FCC fields. |
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
330 (goto-char (point-min)) |
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
331 (if (re-search-forward "^FCC:" delimline t) |
6f41e17b3452
(smtpmail-send-it): Don't handle FCC fields until after determining FROM field.
Richard M. Stallman <rms@gnu.org>
parents:
15451
diff
changeset
|
332 (mail-do-fcc delimline)) |
15345 | 333 (if mail-interactive |
41716
e467d0e8f243
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41497
diff
changeset
|
334 (with-current-buffer errbuf |
15345 | 335 (erase-buffer)))) |
336 ;; | |
337 ;; | |
338 ;; | |
339 (setq smtpmail-address-buffer (generate-new-buffer "*smtp-mail*")) | |
340 (setq smtpmail-recipient-address-list | |
21683
dfb671ba22f8
(smtpmail-send-it): Deleted all code related to Resent-To: processing.
Richard M. Stallman <rms@gnu.org>
parents:
20058
diff
changeset
|
341 (smtpmail-deduce-address-list tembuf (point-min) delimline)) |
15345 | 342 (kill-buffer smtpmail-address-buffer) |
44883
7d867b33aa2d
(smtpmail-try-auth-methods): host is not in the authinfo/netrc => cred=nil.
Sam Steingold <sds@gnu.org>
parents:
44868
diff
changeset
|
343 |
15345 | 344 (smtpmail-do-bcc delimline) |
18094 | 345 ; Send or queue |
346 (if (not smtpmail-queue-mail) | |
347 (if (not (null smtpmail-recipient-address-list)) | |
44883
7d867b33aa2d
(smtpmail-try-auth-methods): host is not in the authinfo/netrc => cred=nil.
Sam Steingold <sds@gnu.org>
parents:
44868
diff
changeset
|
348 (if (not (smtpmail-via-smtp |
18094 | 349 smtpmail-recipient-address-list tembuf)) |
350 (error "Sending failed; SMTP protocol error")) | |
351 (error "Sending failed; no recipients")) | |
47436
dc7ce8219431
(smtpmail-send-it): Don't use : in filenames
Simon Josefsson <jas@extundo.com>
parents:
47396
diff
changeset
|
352 (let* ((file-data |
dc7ce8219431
(smtpmail-send-it): Don't use : in filenames
Simon Josefsson <jas@extundo.com>
parents:
47396
diff
changeset
|
353 (expand-file-name |
dc7ce8219431
(smtpmail-send-it): Don't use : in filenames
Simon Josefsson <jas@extundo.com>
parents:
47396
diff
changeset
|
354 (format "%s_%i" |
dc7ce8219431
(smtpmail-send-it): Don't use : in filenames
Simon Josefsson <jas@extundo.com>
parents:
47396
diff
changeset
|
355 (format-time-string "%Y-%m-%d_%H:%M:%S") |
dc7ce8219431
(smtpmail-send-it): Don't use : in filenames
Simon Josefsson <jas@extundo.com>
parents:
47396
diff
changeset
|
356 (setq smtpmail-queue-counter |
dc7ce8219431
(smtpmail-send-it): Don't use : in filenames
Simon Josefsson <jas@extundo.com>
parents:
47396
diff
changeset
|
357 (1+ smtpmail-queue-counter))) |
dc7ce8219431
(smtpmail-send-it): Don't use : in filenames
Simon Josefsson <jas@extundo.com>
parents:
47396
diff
changeset
|
358 smtpmail-queue-dir)) |
dc7ce8219431
(smtpmail-send-it): Don't use : in filenames
Simon Josefsson <jas@extundo.com>
parents:
47396
diff
changeset
|
359 (file-data (convert-standard-filename file-data)) |
dc7ce8219431
(smtpmail-send-it): Don't use : in filenames
Simon Josefsson <jas@extundo.com>
parents:
47396
diff
changeset
|
360 (file-elisp (concat file-data ".el")) |
18094 | 361 (buffer-data (create-file-buffer file-data)) |
362 (buffer-elisp (create-file-buffer file-elisp)) | |
363 (buffer-scratch "*queue-mail*")) | |
51895
2f47cd5fd50d
(smtpmail-send-it): Create smtpmail-queue-dir if it doesn't exist.
Juanma Barranquero <lekktu@gmail.com>
parents:
50973
diff
changeset
|
364 (unless (file-exists-p smtpmail-queue-dir) |
2f47cd5fd50d
(smtpmail-send-it): Create smtpmail-queue-dir if it doesn't exist.
Juanma Barranquero <lekktu@gmail.com>
parents:
50973
diff
changeset
|
365 (make-directory smtpmail-queue-dir t)) |
41716
e467d0e8f243
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41497
diff
changeset
|
366 (with-current-buffer buffer-data |
18094 | 367 (erase-buffer) |
368 (insert-buffer tembuf) | |
369 (write-file file-data) | |
370 (set-buffer buffer-elisp) | |
371 (erase-buffer) | |
372 (insert (concat | |
373 "(setq smtpmail-recipient-address-list '" | |
374 (prin1-to-string smtpmail-recipient-address-list) | |
44883
7d867b33aa2d
(smtpmail-try-auth-methods): host is not in the authinfo/netrc => cred=nil.
Sam Steingold <sds@gnu.org>
parents:
44868
diff
changeset
|
375 ")\n")) |
18094 | 376 (write-file file-elisp) |
377 (set-buffer (generate-new-buffer buffer-scratch)) | |
378 (insert (concat file-data "\n")) | |
44883
7d867b33aa2d
(smtpmail-try-auth-methods): host is not in the authinfo/netrc => cred=nil.
Sam Steingold <sds@gnu.org>
parents:
44868
diff
changeset
|
379 (append-to-file (point-min) |
7d867b33aa2d
(smtpmail-try-auth-methods): host is not in the authinfo/netrc => cred=nil.
Sam Steingold <sds@gnu.org>
parents:
44868
diff
changeset
|
380 (point-max) |
18094 | 381 smtpmail-queue-index) |
382 ) | |
383 (kill-buffer buffer-scratch) | |
384 (kill-buffer buffer-data) | |
385 (kill-buffer buffer-elisp)))) | |
15345 | 386 (kill-buffer tembuf) |
387 (if (bufferp errbuf) | |
388 (kill-buffer errbuf))))) | |
389 | |
48419
03ac1463ec5e
(smtpmail-send-queued-mail): Add autoload cookie.
Juanma Barranquero <lekktu@gmail.com>
parents:
47837
diff
changeset
|
390 ;;;###autoload |
18094 | 391 (defun smtpmail-send-queued-mail () |
392 "Send mail that was queued as a result of setting `smtpmail-queue-mail'." | |
393 (interactive) | |
42225
8ef1ae58dc29
(smtpmail-send-queued-mail): Use
Eli Zaretskii <eliz@gnu.org>
parents:
41921
diff
changeset
|
394 (with-temp-buffer |
8ef1ae58dc29
(smtpmail-send-queued-mail): Use
Eli Zaretskii <eliz@gnu.org>
parents:
41921
diff
changeset
|
395 ;;; Get index, get first mail, send it, update index, get second |
8ef1ae58dc29
(smtpmail-send-queued-mail): Use
Eli Zaretskii <eliz@gnu.org>
parents:
41921
diff
changeset
|
396 ;;; mail, send it, etc... |
8ef1ae58dc29
(smtpmail-send-queued-mail): Use
Eli Zaretskii <eliz@gnu.org>
parents:
41921
diff
changeset
|
397 (let ((file-msg "")) |
8ef1ae58dc29
(smtpmail-send-queued-mail): Use
Eli Zaretskii <eliz@gnu.org>
parents:
41921
diff
changeset
|
398 (insert-file-contents smtpmail-queue-index) |
18094 | 399 (beginning-of-buffer) |
400 (while (not (eobp)) | |
41716
e467d0e8f243
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41497
diff
changeset
|
401 (setq file-msg (buffer-substring (point) (line-end-position))) |
18094 | 402 (load file-msg) |
41921
de4a90cd0a5f
(smtpmail-send-queued-mail): Insert the enqueued messages literally.
Eli Zaretskii <eliz@gnu.org>
parents:
41716
diff
changeset
|
403 ;; Insert the message literally: it is already encoded as per |
de4a90cd0a5f
(smtpmail-send-queued-mail): Insert the enqueued messages literally.
Eli Zaretskii <eliz@gnu.org>
parents:
41716
diff
changeset
|
404 ;; the MIME headers, and code conversions might guess the |
de4a90cd0a5f
(smtpmail-send-queued-mail): Insert the enqueued messages literally.
Eli Zaretskii <eliz@gnu.org>
parents:
41716
diff
changeset
|
405 ;; encoding wrongly. |
42225
8ef1ae58dc29
(smtpmail-send-queued-mail): Use
Eli Zaretskii <eliz@gnu.org>
parents:
41921
diff
changeset
|
406 (with-temp-buffer |
8ef1ae58dc29
(smtpmail-send-queued-mail): Use
Eli Zaretskii <eliz@gnu.org>
parents:
41921
diff
changeset
|
407 (let ((coding-system-for-read 'no-conversion)) |
8ef1ae58dc29
(smtpmail-send-queued-mail): Use
Eli Zaretskii <eliz@gnu.org>
parents:
41921
diff
changeset
|
408 (insert-file-contents file-msg)) |
52347 | 409 (let ((smtpmail-mail-address |
410 (or (and mail-specify-envelope-from (mail-envelope-from)) | |
411 user-mail-address))) | |
412 (if (not (null smtpmail-recipient-address-list)) | |
413 (if (not (smtpmail-via-smtp smtpmail-recipient-address-list | |
414 (current-buffer))) | |
415 (error "Sending failed; SMTP protocol error")) | |
416 (error "Sending failed; no recipients")))) | |
18094 | 417 (delete-file file-msg) |
418 (delete-file (concat file-msg ".el")) | |
50931
0ef58c420b53
(smtpmail-send-queued-mail): Use point-at-bol instead of forward-line.
Juanma Barranquero <lekktu@gmail.com>
parents:
50912
diff
changeset
|
419 (delete-region (point-at-bol) (point-at-bol 2))) |
42225
8ef1ae58dc29
(smtpmail-send-queued-mail): Use
Eli Zaretskii <eliz@gnu.org>
parents:
41921
diff
changeset
|
420 (write-region (point-min) (point-max) smtpmail-queue-index)))) |
15345 | 421 |
422 ;(defun smtpmail-via-smtp (host,port,sender,destination,smtpmail-text-buffer) | |
423 | |
424 (defun smtpmail-fqdn () | |
425 (if smtpmail-local-domain | |
426 (concat (system-name) "." smtpmail-local-domain) | |
427 (system-name))) | |
428 | |
41221
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
429 (defsubst smtpmail-cred-server (cred) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
430 (nth 0 cred)) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
431 |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
432 (defsubst smtpmail-cred-port (cred) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
433 (nth 1 cred)) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
434 |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
435 (defsubst smtpmail-cred-key (cred) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
436 (nth 2 cred)) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
437 |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
438 (defsubst smtpmail-cred-user (cred) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
439 (nth 2 cred)) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
440 |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
441 (defsubst smtpmail-cred-cert (cred) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
442 (nth 3 cred)) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
443 |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
444 (defsubst smtpmail-cred-passwd (cred) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
445 (nth 3 cred)) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
446 |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
447 (defun smtpmail-find-credentials (cred server port) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
448 (catch 'done |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
449 (let ((l cred) el) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
450 (while (setq el (pop l)) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
451 (when (and (equal server (smtpmail-cred-server el)) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
452 (equal port (smtpmail-cred-port el))) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
453 (throw 'done el)))))) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
454 |
37800
9cddd888d25f
(maybe-append-domain): Renamed to
Gerd Moellmann <gerd@gnu.org>
parents:
37600
diff
changeset
|
455 (defun smtpmail-maybe-append-domain (recipient) |
9cddd888d25f
(maybe-append-domain): Renamed to
Gerd Moellmann <gerd@gnu.org>
parents:
37600
diff
changeset
|
456 (if (or (not smtpmail-sendto-domain) |
9cddd888d25f
(maybe-append-domain): Renamed to
Gerd Moellmann <gerd@gnu.org>
parents:
37600
diff
changeset
|
457 (string-match "@" recipient)) |
9cddd888d25f
(maybe-append-domain): Renamed to
Gerd Moellmann <gerd@gnu.org>
parents:
37600
diff
changeset
|
458 recipient |
9cddd888d25f
(maybe-append-domain): Renamed to
Gerd Moellmann <gerd@gnu.org>
parents:
37600
diff
changeset
|
459 (concat recipient "@" smtpmail-sendto-domain))) |
9cddd888d25f
(maybe-append-domain): Renamed to
Gerd Moellmann <gerd@gnu.org>
parents:
37600
diff
changeset
|
460 |
41221
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
461 (defun smtpmail-intersection (list1 list2) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
462 (let ((result nil)) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
463 (dolist (el2 list2) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
464 (when (memq el2 list1) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
465 (push el2 result))) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
466 (nreverse result))) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
467 |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
468 (defun smtpmail-open-stream (process-buffer host port) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
469 (let ((cred (smtpmail-find-credentials |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
470 smtpmail-starttls-credentials host port))) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
471 (if (null (and cred (condition-case () |
50973
7f434a265bfa
(smtpmail-open-stream): Don't hard code
Simon Josefsson <jas@extundo.com>
parents:
50931
diff
changeset
|
472 (progn |
7f434a265bfa
(smtpmail-open-stream): Don't hard code
Simon Josefsson <jas@extundo.com>
parents:
50931
diff
changeset
|
473 (require 'starttls) |
7f434a265bfa
(smtpmail-open-stream): Don't hard code
Simon Josefsson <jas@extundo.com>
parents:
50931
diff
changeset
|
474 (call-process starttls-program)) |
41221
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
475 (error nil)))) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
476 ;; The normal case. |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
477 (open-network-stream "SMTP" process-buffer host port) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
478 (let* ((cred-key (smtpmail-cred-key cred)) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
479 (cred-cert (smtpmail-cred-cert cred)) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
480 (starttls-extra-args |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
481 (when (and (stringp cred-key) (stringp cred-cert) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
482 (file-regular-p |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
483 (setq cred-key (expand-file-name cred-key))) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
484 (file-regular-p |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
485 (setq cred-cert (expand-file-name cred-cert)))) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
486 (list "--key-file" cred-key "--cert-file" cred-cert)))) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
487 (starttls-open-stream "SMTP" process-buffer host port))))) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
488 |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
489 (defun smtpmail-try-auth-methods (process supported-extensions host port) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
490 (let* ((mechs (cdr-safe (assoc 'auth supported-extensions))) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
491 (mech (car (smtpmail-intersection smtpmail-auth-supported mechs))) |
44868
865b7fdda4bb
(smtpmail-auth-credentials): Support netrc files as well.
Richard M. Stallman <rms@gnu.org>
parents:
44864
diff
changeset
|
492 (cred (if (stringp smtpmail-auth-credentials) |
865b7fdda4bb
(smtpmail-auth-credentials): Support netrc files as well.
Richard M. Stallman <rms@gnu.org>
parents:
44864
diff
changeset
|
493 (let* ((netrc (netrc-parse smtpmail-auth-credentials)) |
53807
61abf9ce6838
(smtpmail-try-auth-methods): Pass port-name as defaultport to `netrc-machine'.
Sam Steingold <sds@gnu.org>
parents:
53641
diff
changeset
|
494 (port-name (format "%s" (or port "smtp"))) |
61abf9ce6838
(smtpmail-try-auth-methods): Pass port-name as defaultport to `netrc-machine'.
Sam Steingold <sds@gnu.org>
parents:
53641
diff
changeset
|
495 (hostentry (netrc-machine netrc host port-name |
61abf9ce6838
(smtpmail-try-auth-methods): Pass port-name as defaultport to `netrc-machine'.
Sam Steingold <sds@gnu.org>
parents:
53641
diff
changeset
|
496 port-name))) |
44883
7d867b33aa2d
(smtpmail-try-auth-methods): host is not in the authinfo/netrc => cred=nil.
Sam Steingold <sds@gnu.org>
parents:
44868
diff
changeset
|
497 (when hostentry |
7d867b33aa2d
(smtpmail-try-auth-methods): host is not in the authinfo/netrc => cred=nil.
Sam Steingold <sds@gnu.org>
parents:
44868
diff
changeset
|
498 (list host port |
7d867b33aa2d
(smtpmail-try-auth-methods): host is not in the authinfo/netrc => cred=nil.
Sam Steingold <sds@gnu.org>
parents:
44868
diff
changeset
|
499 (netrc-get hostentry "login") |
7d867b33aa2d
(smtpmail-try-auth-methods): host is not in the authinfo/netrc => cred=nil.
Sam Steingold <sds@gnu.org>
parents:
44868
diff
changeset
|
500 (netrc-get hostentry "password")))) |
44868
865b7fdda4bb
(smtpmail-auth-credentials): Support netrc files as well.
Richard M. Stallman <rms@gnu.org>
parents:
44864
diff
changeset
|
501 (smtpmail-find-credentials |
53919
095e499a14ad
(smtpmail-try-auth-methods): Fix typo.
John Paul Wallington <jpw@pobox.com>
parents:
53807
diff
changeset
|
502 smtpmail-auth-credentials host port))) |
41221
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
503 (passwd (when cred |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
504 (or (smtpmail-cred-passwd cred) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
505 (read-passwd |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
506 (format "SMTP password for %s:%s: " |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
507 (smtpmail-cred-server cred) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
508 (smtpmail-cred-port cred)))))) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
509 ret) |
53807
61abf9ce6838
(smtpmail-try-auth-methods): Pass port-name as defaultport to `netrc-machine'.
Sam Steingold <sds@gnu.org>
parents:
53641
diff
changeset
|
510 (when (and cred mech) |
41221
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
511 (cond |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
512 ((eq mech 'cram-md5) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
513 (smtpmail-send-command process (format "AUTH %s" mech)) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
514 (if (or (null (car (setq ret (smtpmail-read-response process)))) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
515 (not (integerp (car ret))) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
516 (>= (car ret) 400)) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
517 (throw 'done nil)) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
518 (when (eq (car ret) 334) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
519 (let* ((challenge (substring (cadr ret) 4)) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
520 (decoded (base64-decode-string challenge)) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
521 (hash (rfc2104-hash 'md5 64 16 passwd decoded)) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
522 (response (concat (smtpmail-cred-user cred) " " hash)) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
523 (encoded (base64-encode-string response))) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
524 (smtpmail-send-command process (format "%s" encoded)) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
525 (if (or (null (car (setq ret (smtpmail-read-response process)))) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
526 (not (integerp (car ret))) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
527 (>= (car ret) 400)) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
528 (throw 'done nil))))) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
529 ((eq mech 'login) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
530 (smtpmail-send-command process "AUTH LOGIN") |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
531 (if (or (null (car (setq ret (smtpmail-read-response process)))) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
532 (not (integerp (car ret))) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
533 (>= (car ret) 400)) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
534 (throw 'done nil)) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
535 (smtpmail-send-command |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
536 process (base64-encode-string (smtpmail-cred-user cred))) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
537 (if (or (null (car (setq ret (smtpmail-read-response process)))) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
538 (not (integerp (car ret))) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
539 (>= (car ret) 400)) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
540 (throw 'done nil)) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
541 (smtpmail-send-command process (base64-encode-string passwd)) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
542 (if (or (null (car (setq ret (smtpmail-read-response process)))) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
543 (not (integerp (car ret))) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
544 (>= (car ret) 400)) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
545 (throw 'done nil))) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
546 (t |
44883
7d867b33aa2d
(smtpmail-try-auth-methods): host is not in the authinfo/netrc => cred=nil.
Sam Steingold <sds@gnu.org>
parents:
44868
diff
changeset
|
547 (error "Mechanism %s not implemented" mech))) |
41221
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
548 ;; Remember the password. |
44868
865b7fdda4bb
(smtpmail-auth-credentials): Support netrc files as well.
Richard M. Stallman <rms@gnu.org>
parents:
44864
diff
changeset
|
549 (when (and (not (stringp smtpmail-auth-credentials)) |
865b7fdda4bb
(smtpmail-auth-credentials): Support netrc files as well.
Richard M. Stallman <rms@gnu.org>
parents:
44864
diff
changeset
|
550 (null (smtpmail-cred-passwd cred))) |
41221
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
551 (setcar (cdr (cdr (cdr cred))) passwd))))) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
552 |
15345 | 553 (defun smtpmail-via-smtp (recipient smtpmail-text-buffer) |
554 (let ((process nil) | |
23142
98c430cac424
(smtpmail-send-it): Add autoload cookie.
Karl Heuer <kwzh@gnu.org>
parents:
22037
diff
changeset
|
555 (host (or smtpmail-smtp-server |
98c430cac424
(smtpmail-send-it): Add autoload cookie.
Karl Heuer <kwzh@gnu.org>
parents:
22037
diff
changeset
|
556 (error "`smtpmail-smtp-server' not defined"))) |
15346
4cd6ff2384dc
(smtpmail-send-it): Fix error messages.
Richard M. Stallman <rms@gnu.org>
parents:
15345
diff
changeset
|
557 (port smtpmail-smtp-service) |
52347 | 558 ;; smtpmail-mail-address should be set to the appropriate |
559 ;; buffer-local value by the caller, but in case not: | |
560 (envelope-from (or smtpmail-mail-address | |
561 (and mail-specify-envelope-from | |
562 (mail-envelope-from)) | |
563 user-mail-address)) | |
15345 | 564 response-code |
15346
4cd6ff2384dc
(smtpmail-send-it): Fix error messages.
Richard M. Stallman <rms@gnu.org>
parents:
15345
diff
changeset
|
565 greeting |
18092
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
566 process-buffer |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
567 (supported-extensions '())) |
15345 | 568 (unwind-protect |
569 (catch 'done | |
570 ;; get or create the trace buffer | |
571 (setq process-buffer | |
572 (get-buffer-create (format "*trace of SMTP session to %s*" host))) | |
573 | |
574 ;; clear the trace buffer of old output | |
41716
e467d0e8f243
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41497
diff
changeset
|
575 (with-current-buffer process-buffer |
15345 | 576 (erase-buffer)) |
577 | |
578 ;; open the connection to the server | |
41221
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
579 (setq process (smtpmail-open-stream process-buffer host port)) |
15345 | 580 (and (null process) (throw 'done nil)) |
581 | |
582 ;; set the send-filter | |
583 (set-process-filter process 'smtpmail-process-filter) | |
584 | |
41716
e467d0e8f243
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41497
diff
changeset
|
585 (with-current-buffer process-buffer |
22037
cb95bfcd442a
(smtpmail-via-smtp): Speciy process coding system.
Richard M. Stallman <rms@gnu.org>
parents:
21862
diff
changeset
|
586 (set-buffer-process-coding-system 'raw-text-unix 'raw-text-unix) |
15345 | 587 (make-local-variable 'smtpmail-read-point) |
588 (setq smtpmail-read-point (point-min)) | |
589 | |
44883
7d867b33aa2d
(smtpmail-try-auth-methods): host is not in the authinfo/netrc => cred=nil.
Sam Steingold <sds@gnu.org>
parents:
44868
diff
changeset
|
590 |
15345 | 591 (if (or (null (car (setq greeting (smtpmail-read-response process)))) |
592 (not (integerp (car greeting))) | |
593 (>= (car greeting) 400)) | |
594 (throw 'done nil) | |
595 ) | |
596 | |
41221
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
597 (let ((do-ehlo t) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
598 (do-starttls t)) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
599 (while do-ehlo |
18092
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
600 ;; EHLO |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
601 (smtpmail-send-command process (format "EHLO %s" (smtpmail-fqdn))) |
15345 | 602 |
41221
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
603 (if (or (null (car (setq response-code |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
604 (smtpmail-read-response process)))) |
15345 | 605 (not (integerp (car response-code))) |
606 (>= (car response-code) 400)) | |
18092
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
607 (progn |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
608 ;; HELO |
41221
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
609 (smtpmail-send-command |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
610 process (format "HELO %s" (smtpmail-fqdn))) |
18092
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
611 |
41221
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
612 (if (or (null (car (setq response-code |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
613 (smtpmail-read-response process)))) |
18092
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
614 (not (integerp (car response-code))) |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
615 (>= (car response-code) 400)) |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
616 (throw 'done nil))) |
41221
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
617 (dolist (line (cdr (cdr response-code))) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
618 (let ((name (mapcar (lambda (s) (intern (downcase s))) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
619 (split-string (substring line 4) "[ ]")))) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
620 (and (eq (length name) 1) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
621 (setq name (car name))) |
18092
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
622 (and name |
41221
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
623 (cond ((memq (if (consp name) (car name) name) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
624 '(verb xvrb 8bitmime onex xone |
18092
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
625 expn size dsn etrn |
41221
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
626 enhancedstatuscodes |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
627 help xusr |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
628 auth=login auth starttls)) |
18092
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
629 (setq supported-extensions |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
630 (cons name supported-extensions))) |
37598
595c23d107f8
(smtpmail-warn-about-unknown-extensions): New
Gerd Moellmann <gerd@gnu.org>
parents:
26028
diff
changeset
|
631 (smtpmail-warn-about-unknown-extensions |
41221
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
632 (message "Unknown extension %s" name))))))) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
633 |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
634 (if (and do-starttls |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
635 (smtpmail-find-credentials smtpmail-starttls-credentials host port) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
636 (member 'starttls supported-extensions) |
47672
666b84b52b82
(smtpmail-via-smtp): Only negotiate starttls on
Simon Josefsson <jas@extundo.com>
parents:
47436
diff
changeset
|
637 (numberp (process-id process))) |
41221
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
638 (progn |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
639 (smtpmail-send-command process (format "STARTTLS")) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
640 (if (or (null (car (setq response-code (smtpmail-read-response process)))) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
641 (not (integerp (car response-code))) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
642 (>= (car response-code) 400)) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
643 (throw 'done nil)) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
644 (starttls-negotiate process) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
645 (setq do-starttls nil)) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
646 (setq do-ehlo nil)))) |
44883
7d867b33aa2d
(smtpmail-try-auth-methods): host is not in the authinfo/netrc => cred=nil.
Sam Steingold <sds@gnu.org>
parents:
44868
diff
changeset
|
647 |
41221
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
648 (smtpmail-try-auth-methods process supported-extensions host port) |
18092
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
649 |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
650 (if (or (member 'onex supported-extensions) |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
651 (member 'xone supported-extensions)) |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
652 (progn |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
653 (smtpmail-send-command process (format "ONEX")) |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
654 (if (or (null (car (setq response-code (smtpmail-read-response process)))) |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
655 (not (integerp (car response-code))) |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
656 (>= (car response-code) 400)) |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
657 (throw 'done nil)))) |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
658 |
41221
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
659 (if (and smtpmail-debug-verb |
18092
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
660 (or (member 'verb supported-extensions) |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
661 (member 'xvrb supported-extensions))) |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
662 (progn |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
663 (smtpmail-send-command process (format "VERB")) |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
664 (if (or (null (car (setq response-code (smtpmail-read-response process)))) |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
665 (not (integerp (car response-code))) |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
666 (>= (car response-code) 400)) |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
667 (throw 'done nil)))) |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
668 |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
669 (if (member 'xusr supported-extensions) |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
670 (progn |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
671 (smtpmail-send-command process (format "XUSR")) |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
672 (if (or (null (car (setq response-code (smtpmail-read-response process)))) |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
673 (not (integerp (car response-code))) |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
674 (>= (car response-code) 400)) |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
675 (throw 'done nil)))) |
15345 | 676 |
52642
79320037f627
(smtpmail-via-smtp): Don't insert a space
Eli Zaretskii <eliz@gnu.org>
parents:
52401
diff
changeset
|
677 ;; MAIL FROM:<sender> |
18092
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
678 (let ((size-part |
41221
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
679 (if (or (member 'size supported-extensions) |
b6fd3363a398
(smtpmail-cred-server, smtpmail-cred-port, smtpmail-cred-key)
Richard M. Stallman <rms@gnu.org>
parents:
40033
diff
changeset
|
680 (assoc 'size supported-extensions)) |
18092
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
681 (format " SIZE=%d" |
41716
e467d0e8f243
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41497
diff
changeset
|
682 (with-current-buffer smtpmail-text-buffer |
18092
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
683 ;; size estimate: |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
684 (+ (- (point-max) (point-min)) |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
685 ;; Add one byte for each change-of-line |
53641
e33121530d13
Jesper Harder <harder@ifa.au.dk>
Glenn Morris <rgm@gnu.org>
parents:
53619
diff
changeset
|
686 ;; because of CR-LF representation: |
e33121530d13
Jesper Harder <harder@ifa.au.dk>
Glenn Morris <rgm@gnu.org>
parents:
53619
diff
changeset
|
687 (count-lines (point-min) (point-max))))) |
18092
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
688 "")) |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
689 (body-part |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
690 (if (member '8bitmime supported-extensions) |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
691 ;; FIXME: |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
692 ;; Code should be added here that transforms |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
693 ;; the contents of the message buffer into |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
694 ;; something the receiving SMTP can handle. |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
695 ;; For a receiver that supports 8BITMIME, this |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
696 ;; may mean converting BINARY to BASE64, or |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
697 ;; adding Content-Transfer-Encoding and the |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
698 ;; other MIME headers. The code should also |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
699 ;; return an indication of what encoding the |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
700 ;; message buffer is now, i.e. ASCII or |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
701 ;; 8BITMIME. |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
702 (if nil |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
703 " BODY=8BITMIME" |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
704 "") |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
705 ""))) |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
706 ; (smtpmail-send-command process (format "MAIL FROM:%s@%s" (user-login-name) (smtpmail-fqdn))) |
52642
79320037f627
(smtpmail-via-smtp): Don't insert a space
Eli Zaretskii <eliz@gnu.org>
parents:
52401
diff
changeset
|
707 (smtpmail-send-command process (format "MAIL FROM:<%s>%s%s" |
52347 | 708 envelope-from |
18092
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
709 size-part |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
710 body-part)) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48846
diff
changeset
|
711 |
18092
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
712 (if (or (null (car (setq response-code (smtpmail-read-response process)))) |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
713 (not (integerp (car response-code))) |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
714 (>= (car response-code) 400)) |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
715 (throw 'done nil) |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
716 )) |
44883
7d867b33aa2d
(smtpmail-try-auth-methods): host is not in the authinfo/netrc => cred=nil.
Sam Steingold <sds@gnu.org>
parents:
44868
diff
changeset
|
717 |
52642
79320037f627
(smtpmail-via-smtp): Don't insert a space
Eli Zaretskii <eliz@gnu.org>
parents:
52401
diff
changeset
|
718 ;; RCPT TO:<recipient> |
15346
4cd6ff2384dc
(smtpmail-send-it): Fix error messages.
Richard M. Stallman <rms@gnu.org>
parents:
15345
diff
changeset
|
719 (let ((n 0)) |
4cd6ff2384dc
(smtpmail-send-it): Fix error messages.
Richard M. Stallman <rms@gnu.org>
parents:
15345
diff
changeset
|
720 (while (not (null (nth n recipient))) |
52642
79320037f627
(smtpmail-via-smtp): Don't insert a space
Eli Zaretskii <eliz@gnu.org>
parents:
52401
diff
changeset
|
721 (smtpmail-send-command process (format "RCPT TO:<%s>" (smtpmail-maybe-append-domain (nth n recipient)))) |
15346
4cd6ff2384dc
(smtpmail-send-it): Fix error messages.
Richard M. Stallman <rms@gnu.org>
parents:
15345
diff
changeset
|
722 (setq n (1+ n)) |
15345 | 723 |
18092
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
724 (setq response-code (smtpmail-read-response process)) |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
725 (if (or (null (car response-code)) |
15346
4cd6ff2384dc
(smtpmail-send-it): Fix error messages.
Richard M. Stallman <rms@gnu.org>
parents:
15345
diff
changeset
|
726 (not (integerp (car response-code))) |
4cd6ff2384dc
(smtpmail-send-it): Fix error messages.
Richard M. Stallman <rms@gnu.org>
parents:
15345
diff
changeset
|
727 (>= (car response-code) 400)) |
4cd6ff2384dc
(smtpmail-send-it): Fix error messages.
Richard M. Stallman <rms@gnu.org>
parents:
15345
diff
changeset
|
728 (throw 'done nil) |
4cd6ff2384dc
(smtpmail-send-it): Fix error messages.
Richard M. Stallman <rms@gnu.org>
parents:
15345
diff
changeset
|
729 ) |
4cd6ff2384dc
(smtpmail-send-it): Fix error messages.
Richard M. Stallman <rms@gnu.org>
parents:
15345
diff
changeset
|
730 )) |
44883
7d867b33aa2d
(smtpmail-try-auth-methods): host is not in the authinfo/netrc => cred=nil.
Sam Steingold <sds@gnu.org>
parents:
44868
diff
changeset
|
731 |
15345 | 732 ;; DATA |
733 (smtpmail-send-command process "DATA") | |
734 | |
735 (if (or (null (car (setq response-code (smtpmail-read-response process)))) | |
736 (not (integerp (car response-code))) | |
737 (>= (car response-code) 400)) | |
738 (throw 'done nil) | |
739 ) | |
740 | |
741 ;; Mail contents | |
742 (smtpmail-send-data process smtpmail-text-buffer) | |
743 | |
744 ;;DATA end "." | |
745 (smtpmail-send-command process ".") | |
746 | |
747 (if (or (null (car (setq response-code (smtpmail-read-response process)))) | |
748 (not (integerp (car response-code))) | |
749 (>= (car response-code) 400)) | |
750 (throw 'done nil) | |
751 ) | |
752 | |
753 ;;QUIT | |
754 ; (smtpmail-send-command process "QUIT") | |
755 ; (and (null (car (smtpmail-read-response process))) | |
756 ; (throw 'done nil)) | |
757 t )) | |
758 (if process | |
41716
e467d0e8f243
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41497
diff
changeset
|
759 (with-current-buffer (process-buffer process) |
15345 | 760 (smtpmail-send-command process "QUIT") |
761 (smtpmail-read-response process) | |
762 | |
763 ; (if (or (null (car (setq response-code (smtpmail-read-response process)))) | |
764 ; (not (integerp (car response-code))) | |
765 ; (>= (car response-code) 400)) | |
766 ; (throw 'done nil) | |
767 ; ) | |
47117
c6c0e4cc9d0a
(smtpmail-via-smtp): Delete process buffer
Simon Josefsson <jas@extundo.com>
parents:
45252
diff
changeset
|
768 (delete-process process) |
c6c0e4cc9d0a
(smtpmail-via-smtp): Delete process buffer
Simon Josefsson <jas@extundo.com>
parents:
45252
diff
changeset
|
769 (unless smtpmail-debug-info |
c6c0e4cc9d0a
(smtpmail-via-smtp): Delete process buffer
Simon Josefsson <jas@extundo.com>
parents:
45252
diff
changeset
|
770 (kill-buffer process-buffer))))))) |
15345 | 771 |
772 | |
773 (defun smtpmail-process-filter (process output) | |
41716
e467d0e8f243
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41497
diff
changeset
|
774 (with-current-buffer (process-buffer process) |
15345 | 775 (goto-char (point-max)) |
776 (insert output))) | |
777 | |
778 (defun smtpmail-read-response (process) | |
779 (let ((case-fold-search nil) | |
18092
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
780 (response-strings nil) |
15345 | 781 (response-continue t) |
18092
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
782 (return-value '(nil ())) |
15345 | 783 match-end) |
54350
e7ea873f6f2e
(smtpmail-read-response): Abort if process has
Simon Josefsson <jas@extundo.com>
parents:
53919
diff
changeset
|
784 (catch 'done |
e7ea873f6f2e
(smtpmail-read-response): Abort if process has
Simon Josefsson <jas@extundo.com>
parents:
53919
diff
changeset
|
785 (while response-continue |
e7ea873f6f2e
(smtpmail-read-response): Abort if process has
Simon Josefsson <jas@extundo.com>
parents:
53919
diff
changeset
|
786 (goto-char smtpmail-read-point) |
e7ea873f6f2e
(smtpmail-read-response): Abort if process has
Simon Josefsson <jas@extundo.com>
parents:
53919
diff
changeset
|
787 (while (not (search-forward "\r\n" nil t)) |
e7ea873f6f2e
(smtpmail-read-response): Abort if process has
Simon Josefsson <jas@extundo.com>
parents:
53919
diff
changeset
|
788 (unless (memq (process-status process) '(open run)) |
e7ea873f6f2e
(smtpmail-read-response): Abort if process has
Simon Josefsson <jas@extundo.com>
parents:
53919
diff
changeset
|
789 (throw 'done nil)) |
e7ea873f6f2e
(smtpmail-read-response): Abort if process has
Simon Josefsson <jas@extundo.com>
parents:
53919
diff
changeset
|
790 (accept-process-output process) |
e7ea873f6f2e
(smtpmail-read-response): Abort if process has
Simon Josefsson <jas@extundo.com>
parents:
53919
diff
changeset
|
791 (goto-char smtpmail-read-point)) |
15345 | 792 |
54350
e7ea873f6f2e
(smtpmail-read-response): Abort if process has
Simon Josefsson <jas@extundo.com>
parents:
53919
diff
changeset
|
793 (setq match-end (point)) |
e7ea873f6f2e
(smtpmail-read-response): Abort if process has
Simon Josefsson <jas@extundo.com>
parents:
53919
diff
changeset
|
794 (setq response-strings |
e7ea873f6f2e
(smtpmail-read-response): Abort if process has
Simon Josefsson <jas@extundo.com>
parents:
53919
diff
changeset
|
795 (cons (buffer-substring smtpmail-read-point (- match-end 2)) |
e7ea873f6f2e
(smtpmail-read-response): Abort if process has
Simon Josefsson <jas@extundo.com>
parents:
53919
diff
changeset
|
796 response-strings)) |
44883
7d867b33aa2d
(smtpmail-try-auth-methods): host is not in the authinfo/netrc => cred=nil.
Sam Steingold <sds@gnu.org>
parents:
44868
diff
changeset
|
797 |
54350
e7ea873f6f2e
(smtpmail-read-response): Abort if process has
Simon Josefsson <jas@extundo.com>
parents:
53919
diff
changeset
|
798 (goto-char smtpmail-read-point) |
e7ea873f6f2e
(smtpmail-read-response): Abort if process has
Simon Josefsson <jas@extundo.com>
parents:
53919
diff
changeset
|
799 (if (looking-at "[0-9]+ ") |
e7ea873f6f2e
(smtpmail-read-response): Abort if process has
Simon Josefsson <jas@extundo.com>
parents:
53919
diff
changeset
|
800 (let ((begin (match-beginning 0)) |
e7ea873f6f2e
(smtpmail-read-response): Abort if process has
Simon Josefsson <jas@extundo.com>
parents:
53919
diff
changeset
|
801 (end (match-end 0))) |
e7ea873f6f2e
(smtpmail-read-response): Abort if process has
Simon Josefsson <jas@extundo.com>
parents:
53919
diff
changeset
|
802 (if smtpmail-debug-info |
e7ea873f6f2e
(smtpmail-read-response): Abort if process has
Simon Josefsson <jas@extundo.com>
parents:
53919
diff
changeset
|
803 (message "%s" (car response-strings))) |
e7ea873f6f2e
(smtpmail-read-response): Abort if process has
Simon Josefsson <jas@extundo.com>
parents:
53919
diff
changeset
|
804 |
e7ea873f6f2e
(smtpmail-read-response): Abort if process has
Simon Josefsson <jas@extundo.com>
parents:
53919
diff
changeset
|
805 (setq smtpmail-read-point match-end) |
15345 | 806 |
54350
e7ea873f6f2e
(smtpmail-read-response): Abort if process has
Simon Josefsson <jas@extundo.com>
parents:
53919
diff
changeset
|
807 ;; ignore lines that start with "0" |
e7ea873f6f2e
(smtpmail-read-response): Abort if process has
Simon Josefsson <jas@extundo.com>
parents:
53919
diff
changeset
|
808 (if (looking-at "0[0-9]+ ") |
e7ea873f6f2e
(smtpmail-read-response): Abort if process has
Simon Josefsson <jas@extundo.com>
parents:
53919
diff
changeset
|
809 nil |
e7ea873f6f2e
(smtpmail-read-response): Abort if process has
Simon Josefsson <jas@extundo.com>
parents:
53919
diff
changeset
|
810 (setq response-continue nil) |
e7ea873f6f2e
(smtpmail-read-response): Abort if process has
Simon Josefsson <jas@extundo.com>
parents:
53919
diff
changeset
|
811 (setq return-value |
e7ea873f6f2e
(smtpmail-read-response): Abort if process has
Simon Josefsson <jas@extundo.com>
parents:
53919
diff
changeset
|
812 (cons (string-to-int |
e7ea873f6f2e
(smtpmail-read-response): Abort if process has
Simon Josefsson <jas@extundo.com>
parents:
53919
diff
changeset
|
813 (buffer-substring begin end)) |
e7ea873f6f2e
(smtpmail-read-response): Abort if process has
Simon Josefsson <jas@extundo.com>
parents:
53919
diff
changeset
|
814 (nreverse response-strings))))) |
15345 | 815 |
54350
e7ea873f6f2e
(smtpmail-read-response): Abort if process has
Simon Josefsson <jas@extundo.com>
parents:
53919
diff
changeset
|
816 (if (looking-at "[0-9]+-") |
e7ea873f6f2e
(smtpmail-read-response): Abort if process has
Simon Josefsson <jas@extundo.com>
parents:
53919
diff
changeset
|
817 (progn (if smtpmail-debug-info |
e7ea873f6f2e
(smtpmail-read-response): Abort if process has
Simon Josefsson <jas@extundo.com>
parents:
53919
diff
changeset
|
818 (message "%s" (car response-strings))) |
e7ea873f6f2e
(smtpmail-read-response): Abort if process has
Simon Josefsson <jas@extundo.com>
parents:
53919
diff
changeset
|
819 (setq smtpmail-read-point match-end) |
e7ea873f6f2e
(smtpmail-read-response): Abort if process has
Simon Josefsson <jas@extundo.com>
parents:
53919
diff
changeset
|
820 (setq response-continue t)) |
e7ea873f6f2e
(smtpmail-read-response): Abort if process has
Simon Josefsson <jas@extundo.com>
parents:
53919
diff
changeset
|
821 (progn |
e7ea873f6f2e
(smtpmail-read-response): Abort if process has
Simon Josefsson <jas@extundo.com>
parents:
53919
diff
changeset
|
822 (setq smtpmail-read-point match-end) |
18092
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
823 (setq response-continue nil) |
8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
Richard M. Stallman <rms@gnu.org>
parents:
17517
diff
changeset
|
824 (setq return-value |
54350
e7ea873f6f2e
(smtpmail-read-response): Abort if process has
Simon Josefsson <jas@extundo.com>
parents:
53919
diff
changeset
|
825 (cons nil (nreverse response-strings))))))) |
e7ea873f6f2e
(smtpmail-read-response): Abort if process has
Simon Josefsson <jas@extundo.com>
parents:
53919
diff
changeset
|
826 (setq smtpmail-read-point match-end)) |
15345 | 827 return-value)) |
828 | |
829 | |
830 (defun smtpmail-send-command (process command) | |
831 (goto-char (point-max)) | |
832 (if (= (aref command 0) ?P) | |
833 (insert "PASS <omitted>\r\n") | |
834 (insert command "\r\n")) | |
835 (setq smtpmail-read-point (point)) | |
836 (process-send-string process command) | |
837 (process-send-string process "\r\n")) | |
838 | |
839 (defun smtpmail-send-data-1 (process data) | |
840 (goto-char (point-max)) | |
841 | |
24773 | 842 (if (and (multibyte-string-p data) |
843 smtpmail-code-conv-from) | |
844 (setq data (string-as-multibyte | |
845 (encode-coding-string data smtpmail-code-conv-from)))) | |
44883
7d867b33aa2d
(smtpmail-try-auth-methods): host is not in the authinfo/netrc => cred=nil.
Sam Steingold <sds@gnu.org>
parents:
44868
diff
changeset
|
846 |
15345 | 847 (if smtpmail-debug-info |
848 (insert data "\r\n")) | |
849 | |
850 (setq smtpmail-read-point (point)) | |
15676
46d74bda4351
(smtpmail-send-data-1): Escape "." at the start of
Karl Heuer <kwzh@gnu.org>
parents:
15648
diff
changeset
|
851 ;; Escape "." at start of a line |
46d74bda4351
(smtpmail-send-data-1): Escape "." at the start of
Karl Heuer <kwzh@gnu.org>
parents:
15648
diff
changeset
|
852 (if (eq (string-to-char data) ?.) |
46d74bda4351
(smtpmail-send-data-1): Escape "." at the start of
Karl Heuer <kwzh@gnu.org>
parents:
15648
diff
changeset
|
853 (process-send-string process ".")) |
15345 | 854 (process-send-string process data) |
855 (process-send-string process "\r\n") | |
856 ) | |
857 | |
858 (defun smtpmail-send-data (process buffer) | |
53619
f69d407a9996
Jesper Harder <harder@ifa.au.dk>
Glenn Morris <rgm@gnu.org>
parents:
52642
diff
changeset
|
859 (let ((data-continue t) sending-data) |
41716
e467d0e8f243
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41497
diff
changeset
|
860 (with-current-buffer buffer |
15345 | 861 (goto-char (point-min))) |
862 (while data-continue | |
41716
e467d0e8f243
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41497
diff
changeset
|
863 (with-current-buffer buffer |
53619
f69d407a9996
Jesper Harder <harder@ifa.au.dk>
Glenn Morris <rgm@gnu.org>
parents:
52642
diff
changeset
|
864 (setq sending-data (buffer-substring (point-at-bol) (point-at-eol))) |
f69d407a9996
Jesper Harder <harder@ifa.au.dk>
Glenn Morris <rgm@gnu.org>
parents:
52642
diff
changeset
|
865 (end-of-line 2) |
f69d407a9996
Jesper Harder <harder@ifa.au.dk>
Glenn Morris <rgm@gnu.org>
parents:
52642
diff
changeset
|
866 (setq data-continue (not (eobp)))) |
f69d407a9996
Jesper Harder <harder@ifa.au.dk>
Glenn Morris <rgm@gnu.org>
parents:
52642
diff
changeset
|
867 (smtpmail-send-data-1 process sending-data)))) |
15345 | 868 |
869 (defun smtpmail-deduce-address-list (smtpmail-text-buffer header-start header-end) | |
870 "Get address list suitable for smtp RCPT TO: <address>." | |
24663
39edc9c7b235
(smtpmail-deduce-address-list): Bind variables
Andrew Innes <andrewi@gnu.org>
parents:
24455
diff
changeset
|
871 (unwind-protect |
41716
e467d0e8f243
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41497
diff
changeset
|
872 (with-current-buffer smtpmail-address-buffer |
e467d0e8f243
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41497
diff
changeset
|
873 (erase-buffer) |
24663
39edc9c7b235
(smtpmail-deduce-address-list): Bind variables
Andrew Innes <andrewi@gnu.org>
parents:
24455
diff
changeset
|
874 (let |
39edc9c7b235
(smtpmail-deduce-address-list): Bind variables
Andrew Innes <andrewi@gnu.org>
parents:
24455
diff
changeset
|
875 ((case-fold-search t) |
39edc9c7b235
(smtpmail-deduce-address-list): Bind variables
Andrew Innes <andrewi@gnu.org>
parents:
24455
diff
changeset
|
876 (simple-address-list "") |
39edc9c7b235
(smtpmail-deduce-address-list): Bind variables
Andrew Innes <andrewi@gnu.org>
parents:
24455
diff
changeset
|
877 this-line |
39edc9c7b235
(smtpmail-deduce-address-list): Bind variables
Andrew Innes <andrewi@gnu.org>
parents:
24455
diff
changeset
|
878 this-line-end |
39edc9c7b235
(smtpmail-deduce-address-list): Bind variables
Andrew Innes <andrewi@gnu.org>
parents:
24455
diff
changeset
|
879 addr-regexp) |
15345 | 880 (insert-buffer-substring smtpmail-text-buffer header-start header-end) |
881 (goto-char (point-min)) | |
15648
2feeabc94834
(smtpmail-deduce-address-list): Handle RESENT-* fields.
Karl Heuer <kwzh@gnu.org>
parents:
15595
diff
changeset
|
882 ;; RESENT-* fields should stop processing of regular fields. |
2feeabc94834
(smtpmail-deduce-address-list): Handle RESENT-* fields.
Karl Heuer <kwzh@gnu.org>
parents:
15595
diff
changeset
|
883 (save-excursion |
41716
e467d0e8f243
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41497
diff
changeset
|
884 (setq addr-regexp |
e467d0e8f243
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41497
diff
changeset
|
885 (if (re-search-forward "^Resent-\\(to\\|cc\\|bcc\\):" |
e467d0e8f243
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41497
diff
changeset
|
886 header-end t) |
e467d0e8f243
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41497
diff
changeset
|
887 "^Resent-\\(to\\|cc\\|bcc\\):" |
e467d0e8f243
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41497
diff
changeset
|
888 "^\\(To:\\|Cc:\\|Bcc:\\)"))) |
15648
2feeabc94834
(smtpmail-deduce-address-list): Handle RESENT-* fields.
Karl Heuer <kwzh@gnu.org>
parents:
15595
diff
changeset
|
889 |
2feeabc94834
(smtpmail-deduce-address-list): Handle RESENT-* fields.
Karl Heuer <kwzh@gnu.org>
parents:
15595
diff
changeset
|
890 (while (re-search-forward addr-regexp header-end t) |
15345 | 891 (replace-match "") |
892 (setq this-line (match-beginning 0)) | |
893 (forward-line 1) | |
894 ;; get any continuation lines | |
895 (while (and (looking-at "^[ \t]+") (< (point) header-end)) | |
896 (forward-line 1)) | |
897 (setq this-line-end (point-marker)) | |
898 (setq simple-address-list | |
899 (concat simple-address-list " " | |
900 (mail-strip-quoted-names (buffer-substring this-line this-line-end)))) | |
901 ) | |
902 (erase-buffer) | |
41497
608d7b92d289
Simplify previous change.
Richard M. Stallman <rms@gnu.org>
parents:
41492
diff
changeset
|
903 (insert " " simple-address-list "\n") |
15345 | 904 (subst-char-in-region (point-min) (point-max) 10 ? t);; newline --> blank |
905 (subst-char-in-region (point-min) (point-max) ?, ? t);; comma --> blank | |
906 (subst-char-in-region (point-min) (point-max) 9 ? t);; tab --> blank | |
907 | |
908 (goto-char (point-min)) | |
909 ;; tidyness in case hook is not robust when it looks at this | |
910 (while (re-search-forward "[ \t]+" header-end t) (replace-match " ")) | |
911 | |
912 (goto-char (point-min)) | |
15346
4cd6ff2384dc
(smtpmail-send-it): Fix error messages.
Richard M. Stallman <rms@gnu.org>
parents:
15345
diff
changeset
|
913 (let (recipient-address-list) |
15451
89c1e7fe879a
(smtpmail-smtp-service): Use port 25 as default.
Richard M. Stallman <rms@gnu.org>
parents:
15372
diff
changeset
|
914 (while (re-search-forward " \\([^ ]+\\) " (point-max) t) |
15346
4cd6ff2384dc
(smtpmail-send-it): Fix error messages.
Richard M. Stallman <rms@gnu.org>
parents:
15345
diff
changeset
|
915 (backward-char 1) |
15451
89c1e7fe879a
(smtpmail-smtp-service): Use port 25 as default.
Richard M. Stallman <rms@gnu.org>
parents:
15372
diff
changeset
|
916 (setq recipient-address-list (cons (buffer-substring (match-beginning 1) (match-end 1)) |
89c1e7fe879a
(smtpmail-smtp-service): Use port 25 as default.
Richard M. Stallman <rms@gnu.org>
parents:
15372
diff
changeset
|
917 recipient-address-list)) |
15346
4cd6ff2384dc
(smtpmail-send-it): Fix error messages.
Richard M. Stallman <rms@gnu.org>
parents:
15345
diff
changeset
|
918 ) |
4cd6ff2384dc
(smtpmail-send-it): Fix error messages.
Richard M. Stallman <rms@gnu.org>
parents:
15345
diff
changeset
|
919 (setq smtpmail-recipient-address-list recipient-address-list)) |
15345 | 920 |
921 ) | |
24663
39edc9c7b235
(smtpmail-deduce-address-list): Bind variables
Andrew Innes <andrewi@gnu.org>
parents:
24455
diff
changeset
|
922 ) |
15345 | 923 ) |
924 ) | |
925 | |
926 | |
927 (defun smtpmail-do-bcc (header-end) | |
21683
dfb671ba22f8
(smtpmail-send-it): Deleted all code related to Resent-To: processing.
Richard M. Stallman <rms@gnu.org>
parents:
20058
diff
changeset
|
928 "Delete [Resent-]BCC: and their continuation lines from the header area. |
15345 | 929 There may be multiple BCC: lines, and each may have arbitrarily |
930 many continuation lines." | |
931 (let ((case-fold-search t)) | |
24455 | 932 (save-excursion |
933 (goto-char (point-min)) | |
934 ;; iterate over all BCC: lines | |
935 (while (re-search-forward "^\\(RESENT-\\)?BCC:" header-end t) | |
936 (delete-region (match-beginning 0) | |
937 (progn (forward-line 1) (point))) | |
938 ;; get rid of any continuation lines | |
939 (while (and (looking-at "^[ \t].*\n") (< (point) header-end)) | |
940 (replace-match "")))))) | |
15345 | 941 |
942 | |
943 (provide 'smtpmail) | |
944 | |
52401 | 945 ;;; arch-tag: a76992df-6d71-43b7-9e72-4bacc6c05466 |
17517 | 946 ;;; smtpmail.el ends here |