comparison lisp/mail/smtpmail.el @ 15346:4cd6ff2384dc

(smtpmail-send-it): Fix error messages. (smtpmail-deduce-address-list): Bind recipient-address-list with let. (smtpmail-via-smtp): Bind greeting, n, process-buffer.
author Richard M. Stallman <rms@gnu.org>
date Fri, 07 Jun 1996 14:28:16 +0000
parents 4eef6c1687f8
children abcc218dcbbc
comparison
equal deleted inserted replaced
15345:4eef6c1687f8 15346:4cd6ff2384dc
158 158
159 (smtpmail-do-bcc delimline) 159 (smtpmail-do-bcc delimline)
160 160
161 (if (not (null smtpmail-recipient-address-list)) 161 (if (not (null smtpmail-recipient-address-list))
162 (if (not (smtpmail-via-smtp smtpmail-recipient-address-list tembuf)) 162 (if (not (smtpmail-via-smtp smtpmail-recipient-address-list tembuf))
163 (error "Sending... Failed. SMTP Protocol Error.")) 163 (error "Sending failed; SMTP protocol error"))
164 (error "Sending... failed. No recipients.")) 164 (error "Sending failed; no recipients"))
165 ) 165 )
166 (kill-buffer tembuf) 166 (kill-buffer tembuf)
167 (if (bufferp errbuf) 167 (if (bufferp errbuf)
168 (kill-buffer errbuf))))) 168 (kill-buffer errbuf)))))
169 169
175 (concat (system-name) "." smtpmail-local-domain) 175 (concat (system-name) "." smtpmail-local-domain)
176 (system-name))) 176 (system-name)))
177 177
178 (defun smtpmail-via-smtp (recipient smtpmail-text-buffer) 178 (defun smtpmail-via-smtp (recipient smtpmail-text-buffer)
179 (let ((process nil) 179 (let ((process nil)
180 host 180 (host smtpmail-smtp-server)
181 port 181 (port smtpmail-smtp-service)
182 response-code 182 response-code
183 ) 183 greeting
184 (setq host smtpmail-smtp-server) 184 process-buffer)
185 (setq port smtpmail-smtp-service)
186
187 (unwind-protect 185 (unwind-protect
188 (catch 'done 186 (catch 'done
189 ;; get or create the trace buffer 187 ;; get or create the trace buffer
190 (setq process-buffer 188 (setq process-buffer
191 (get-buffer-create (format "*trace of SMTP session to %s*" host))) 189 (get-buffer-create (format "*trace of SMTP session to %s*" host)))
232 (>= (car response-code) 400)) 230 (>= (car response-code) 400))
233 (throw 'done nil) 231 (throw 'done nil)
234 ) 232 )
235 233
236 ;; RCPT TO: <recipient> 234 ;; RCPT TO: <recipient>
237 (setq n 0) 235 (let ((n 0))
238 (while (not (null (nth n recipient))) 236 (while (not (null (nth n recipient)))
239 (smtpmail-send-command process (format "RCPT TO: %s" (nth n recipient))) 237 (smtpmail-send-command process (format "RCPT TO: %s" (nth n recipient)))
240 (setq n (1+ n)) 238 (setq n (1+ n))
241 239
242 (if (or (null (car (setq response-code (smtpmail-read-response process)))) 240 (if (or (null (car (setq response-code (smtpmail-read-response process))))
243 (not (integerp (car response-code))) 241 (not (integerp (car response-code)))
244 (>= (car response-code) 400)) 242 (>= (car response-code) 400))
245 (throw 'done nil) 243 (throw 'done nil)
246 ) 244 )
247 ) 245 ))
248 246
249 ;; DATA 247 ;; DATA
250 (smtpmail-send-command process "DATA") 248 (smtpmail-send-command process "DATA")
251 249
252 (if (or (null (car (setq response-code (smtpmail-read-response process)))) 250 (if (or (null (car (setq response-code (smtpmail-read-response process))))
439 (goto-char (point-min)) 437 (goto-char (point-min))
440 ;; tidyness in case hook is not robust when it looks at this 438 ;; tidyness in case hook is not robust when it looks at this
441 (while (re-search-forward "[ \t]+" header-end t) (replace-match " ")) 439 (while (re-search-forward "[ \t]+" header-end t) (replace-match " "))
442 440
443 (goto-char (point-min)) 441 (goto-char (point-min))
444 (setq recipient-address-list nil) 442 (let (recipient-address-list)
445 (while (re-search-forward " [^ ]+ " (point-max) t) 443 (while (re-search-forward " [^ ]+ " (point-max) t)
446 (backward-char 1) 444 (backward-char 1)
447 (setq recipient-address-list(cons (buffer-substring (match-beginning 0) (match-end 0)) 445 (setq recipient-address-list(cons (buffer-substring (match-beginning 0) (match-end 0))
448 recipient-address-list)) 446 recipient-address-list))
449 ) 447 )
450 (setq smtpmail-recipient-address-list recipient-address-list) 448 (setq smtpmail-recipient-address-list recipient-address-list))
451 449
452 ) 450 )
453 ) 451 )
454 ) 452 )
455 ) 453 )