From: " fullname) (let ((fullname-start (+ (point-min) 6)) (fullname-end (point-marker))) (goto-char fullname- start) ;; Look for a character that cannot appear unquoted ;; according to RFC 822. (if (or (re-search- forward "[*- !#-'*+/-9=?A-Z*-~]" fullname-end 1) quote-fullname) (progn ;; Quote fullname, escaping specials. (goto-char fullname-start) (insert "\"") (while (re-search-forward "[\"\\]" fullname-end 1) (replace-match "\\\\\\&" t)) (insert "\"")))) (insert " <" login ">\n")) ((eq mail-from-style 'parens) (insert "From: " login " (") (let ((fullname-start (point))) (if quote-fullname (insert "\"")) (insert fullname) (if quote-fullname (insert "\"")) (let ((fullname-end (point-marker))) (goto-char fullname-start) ;; RFC 822 says \ and nonmatching parentheses ;; must be escaped in comments. ;; Escape every instance of ()\ ... (while (re-search-forward "{()\\]" fullname-end 1) (replace-match "\\\\\\&" t)) ;; ... then undo escaping of matching parentheses, ;; including matching nested parentheses. (goto-char fullname-start) (while (re-search-forward "\\(\\=\\\[\ MAMMA)" fullname-end 1) (replace- match "\\1(\\3)" t) (goto-char fullname-start)))) (insert ")\n")) ((null mail-from-style) (insert "From: " login "\n")) ((eq mail-from-style 'system-default) nil) (t (error "Invalid value for ‘mail-from-style'"))))) (defun sendmail-send-it () "Send the current mail buffer using the Sendmail package. This is a suitable value for ‘send-mail-function'. It sends using the external program defined by ‘“sendmail-program'." (require 'mail-utils) (let ((errbuf (if mail-interactive (generate-new-buffer “ sendmail errors") 0)) (tembuf (generate-new-buffer " sendmail temp")) (multibyte enable-multibyte-characters) (case-fold-search nil) (selected-coding (select-message-coding-system) ) resend-to-addresses delimline fcec-was-found (mailbuf (current-buffer) ) (program (if (boundp ‘sendmail-program) sendmail-program "/usr/lib/sendmail") ) 7; Examine these variables now, so that 7; local binding in the mail buffer will take effect. (envelope-from (and mail-specify-envelope-from (or (mail-envelope-from) user-mail-address)))) (unwind-protect (with-current-buffer tembuf (erase-buffer) (unless multibyte (set-buffer-multibyte nil)) (insert-buffer-substring mailbuf) (goto-char (point-max)) +? require one newline at the end. (or (= (preceding-char) ?\n) (insert ?\n)) +? Change header-delimiter to be what sendmail expects. (goto-char (mail-header-end) ) (delete-region (point) (progn (end-of-line) (point))) (setq delimline (point-marker)) (sendmail-sync-aliases) (if mail-aliases (expand-mail-aliases (point-min) delimline)) (goto-char (point-min)) +? Ignore any blank lines in the header (while (and (re-search-forward "\n\n\n*" delimline t) {< (point) delimline)) EFTA00504397

--=PAGE_BREAK=--

7 ; ; ; ; (replace-match "\n")) (goto-char (point-min)) +? Look for Resent- headers. They require sending #7 the message specially. (let ((case-fold-search t)) (goto-char (point-min)) (while (re-search-forward "“Resent-\\(to\\|cc\\|bec\\):" delimline t) 77 Put a list of such addresses in resend-to-addresses. (setq resend-to-addresses (save-restriction ({narrow-to-region (point) (save-excursion (forward-line 1) (while (looking-at "*[ \t]") (forward-line 1)) (point))) {append (mail-parse-comma-list) resend-to-addresses) )) +7 Delete Resent-BCC ourselves (if (save-excursion (beginning-of-line) (looking-at “resent-bcc")) (delete-region (save-excursion (beginning-of-line) (point)) (save-excursion (end-of-line) (1+ (point)))))) Apparently this causes a duplicate Sender. 7; If the From is different than current user, insert Sender. (gote-char (point-min)) (and (re-search-forward "“From:" delimline t) ({progn (require 'mail-utils) (not (string-equal (mail-strip-quoted-names (save-restriction (narrow-to-region (point-min) delimline) (mail-fetch-field "“From"))) (user-login-name) ))) (progn (forward-line 1) (insert “Sender: " (user-login-name) "\n"))) 7; Don't send out a blank subject line (goto-char (point-min)) (if (re-search-forward "*Subject:\\([ \t]*\n\\)+\\b" delimline t) ({replace-match "") +7 This one matches a Subject just before the header delimiter. (if (and (re-search-forward "“Subject:\\({ \t]*\n\\)+" delimline t) (= (match-end 0) delimline)) (replace-match ""))) ¢?; Put the "From:" field in unless for some odd reason #7 they put one in themselves. (goto-char (point-min)) (if (not (re-search-forward "“From:" delimline t)) (mail-insert-from-field)) #? Possibly add a MIME header for the current coding system (let (charset) (goto-char (point-min) ) (and (eq mail-send-nonascii 'mime) (not (re-search-forward "“MIME-version:" delimline t)) (progn (skip-chars-forward "\0-\177") {(/= (point) (point-max))) selected-coding (setq charset (coding-system-get selected-coding 'mime-charset) ) (goto-char delimline) (insert "MIME-version: 1.0\n" “Content-type: text/plain; charset=" (symbol-name charset) EFTA00504398

--=PAGE_BREAK=--

“"\nContent-Transfer-Encoding: 8bit\n"))) 7; Insert an extra newline if we need it to work around 7? Sun's bug that swallows newlines. (goto-char (1+ delimline)) (if (eval mail-mailer-swallows-blank-line) (newline) ) 7+ Find and handle any FCC fields. (goto-char (point-min)) (if (re-search-forward "“FCC:" delimline t) (progn (setq fcc-was-found t) ({mail-do-fce delimline))) (if mail-interactive (with-current-buffer errbuf (erase-buffer) ))) (goto-char (point-min)) (if (let ((case-fold-search t)) {or resend-to-addresses (re-search-forward "*To:\\|*cee:\\|“*bece:" delimline t))) (let* ((default-directory "/") (coding-system-for-write selected-coding) (args {append (list (point-min) (point-max) program nil errbuf nil "-oi") (and envelope-from (list "-f£" envelope-from) ) 7? Don't say "from root" if running under su. (and (equal (user-real-login-name) "root") (list "“-£" (user-login-name) )) (and mail-alias-file (list (concat "-oA" mail-alias-file))) (if mail-interactive ; These mean “report errors to terminal" ; and “deliver interactively" ("-oep" "-odi") +; These mean “report errors by mail" 77 and "deliver in background". "("-oem" "-odb")) ++ Get the addresses from the message 7? unless this is a resend. 7? We must not do that for a resend 7? because we would find the original addresses. +? For a resend, include the specific addresses. (or resend-to-addresses roman) ) (if mail-use-dsn (list "-N" (mapconcat 'symbol-name mail-use-dsn ","))) ; ; , ) ) (exit-value (apply 'call-process-region arqgs))) (or (null exit-value) (eq 0 exit-value) (error "“Sending...failed with exit value $d" exit-value))) (or fcc-was-found (error "No recipients"))) (if mail-interactive (with-current-buffer errbuf (goto-char (point-min)) (while (re-search-forward "\n\n* *" nil t) (replace-match "; ")) {if (not (zerop (buffer-size))) (error “Sending...failed to %s" EFTA00504399

--=PAGE_BREAK=--

(buffer-substring (point-min) (point-max))))))) ({kill-buffer tembuf) {if (bufferp errbuf) (kill-buffer errbuf))))) EFTA00504400