(provide (quote sendmail))

(defvar mail-aliases t "\
Alias of mail address aliases,
or t meaning should be initialized from .mailrc.")

(defvar mail-default-reply-to nil "\
*Address to insert as default Reply-to field of outgoing messages.")

(defvar mail-abbrevs-loaded nil)

(defvar mail-mode-map nil)

(autoload (quote build-mail-aliases) "mailalias" "\
Read mail aliases from ~/.mailrc and set mail-aliases." nil)

(autoload (quote expand-mail-aliases) "mailalias" "\
Expand all mail aliases in suitable header fields found between BEG and END.
Suitable header fields are To, CC and BCC." nil)

(defun mail-setup (to subject in-reply-to cc replybuffer) (byte-code "=‰! ebc
\"ed\")4 M`#d\"*	Y	#
b#p#| #


	!!" [mail-aliases t nil mail-reply-buffer replybuffer to fill-prefix cc opos in-reply-to subject mail-default-reply-to mail-self-blind mail-archive-file-name mail-header-separator file-exists-p "~/.mailrc" build-mail-aliases "To: " insert "
" "	" fill-region newline "CC: " fill-region-as-paragraph "In-reply-to: " "Subject: " "" "Reply-to: " "BCC: " user-login-name "FCC: " set-buffer-modified-p run-hooks mail-setup-hook] 17))

(defun mail-mode nil "\
Major mode for editing mail to be sent.
Separate names of recipients (in To: and Cc: fields) with commas.
Like Text Mode but with these additional commands:
C-c C-s  mail-send (send the message)    C-c C-c  mail-send-and-exit
C-c C-f  move to a header field (and create it if there isn't):
	 C-c C-f C-t  move to To:	C-c C-f C-s  move to Subj:
	 C-c C-f C-b  move to BCC:	C-c C-f C-c  move to CC:
C-c C-w  mail-signature (insert ~/.signature at end).
C-c C-y  mail-yank-original (insert current message, in Rmail).
C-c C-q  mail-fill-yanked-message (fill what was yanked)." (interactive) (byte-code " !
R\"" [mail-reply-buffer nil text-mode-syntax-table mail-mode-map local-abbrev-table text-mode-abbrev-table major-mode mode-name buffer-offer-save t paragraph-start mail-header-separator paragraph-separate kill-all-local-variables make-local-variable set-syntax-table use-local-map mail-mode "Mail" "^" "$\\|^[ 	]*[-_][-_][-_]+$\\|" run-hooks text-mode-hook mail-mode-hook] 10))

(if mail-mode-map nil (setq mail-mode-map (make-sparse-keymap)) (define-key mail-mode-map "?" (quote describe-mode)) (define-key mail-mode-map "" (quote mail-to)) (define-key mail-mode-map "" (quote mail-bcc)) (define-key mail-mode-map "" (quote mail-cc)) (define-key mail-mode-map "" (quote mail-subject)) (define-key mail-mode-map "" (quote mail-signature)) (define-key mail-mode-map "" (quote mail-yank-original)) (define-key mail-mode-map "" (quote mail-fill-yanked-message)) (define-key mail-mode-map "" (quote mail-send-and-exit)) (define-key mail-mode-map "" (quote mail-send)))

(defun mail-send-and-exit (arg) "\
Send message like mail-send, then, if no errors, exit from mail buffer.
Prefix arg means don't delete this window." (interactive "P") (byte-code "ˆ p!?\" ?\" \"!q	=)* /p!!" [arg major-mode nil mail-send bury-buffer one-window-p window-buffer next-window selected-window not rmail-mode delete-window switch-to-buffer other-buffer] 10))

(defun mail-send nil "\
Send the message in the current buffer.
If  mail-interactive  is non-nil, wait for success indication
or error messages, and inform user.
Otherwise any failure is reported in a message back to
the user from the mailer." (interactive) (byte-code "!!! !" [send-mail-function nil message "Sending..." funcall set-buffer-modified-p delete-auto-save-file-if-necessary "Sending...done"] 6))

(defun sendmail-send-it nil (byte-code "	
q !dbhU0ceb!Q!!! Te
#)?! #eb
#!	q ))ed!
& D	?#\"	qeb#! !?ed\"\")))-" [errbuf mail-interactive tembuf case-fold-search nil delimline mailbuf mail-header-separator mail-aliases t sendmail-program generate-new-buffer " sendmail errors" 0 " sendmail temp" ((byte-code "!	!
	!" [tembuf errbuf kill-buffer bufferp] 4)) erase-buffer insert-buffer-substring 10 re-search-forward "^" regexp-quote "
" replace-match backward-char 1 point-marker expand-mail-aliases "

*" "^FCC:" mail-do-fcc "^From:" "^Sender:" forward-line insert "Sender: " user-login-name "^Subject:[ 	]*
" "" apply call-process-region append list boundp "/usr/lib/sendmail" "-oi" "-t" "-f" ("-oem" "-odb") "

* *" "; " zerop buffer-size error "Sending...failed to %s" buffer-substring] 36))

(defun mail-do-fcc (header-end) (byte-code "p!eb
#4` !`\"B!!`\"
q   %	!dbcb#f!cT)@!ped
!," [fcc-list rmailbuf tembuf case-fold-search t header-end nil buffer curbuf beg end generate-new-buffer " rmail output" re-search-forward "^FCC:[ 	]*" buffer-substring end-of-line skip-chars-backward " 	" delete-region match-beginning 0 forward-line 1 erase-buffer insert "
From " user-login-name " " current-time-string "
" insert-buffer-substring 10 2 search-forward forward-char -5 62 get-file-buffer write-region kill-buffer] 23))

(defun mail-to nil "\
Move point to end of To-field." (interactive) (byte-code " !" [nil expand-abbrev mail-position-on-field "To"] 3))

(defun mail-subject nil "\
Move point to end of Subject-field." (interactive) (byte-code " !" [nil expand-abbrev mail-position-on-field "Subject"] 3))

(defun mail-cc nil "\
Move point to end of CC-field.  Create a CC field if none." (interactive) (byte-code " \"!c" [t nil expand-abbrev mail-position-on-field "cc" "to" "
CC: "] 4))

(defun mail-bcc nil "\
Move point to end of BCC-field.  Create a BCC field if none." (interactive) (byte-code " \"!c" [t nil expand-abbrev mail-position-on-field "bcc" "to" "
BCC: "] 4))

(defun mail-position-on-field (field &optional soft) (byte-code "ebQ!!eb!Q#5# !‚HFb!#*" [end case-fold-search t mail-header-separator field nil soft search-forward "
" match-beginning 0 re-search-forward "^" regexp-quote ":" "^[^ 	]" move beginning-of-line skip-chars-backward insert ": "] 12))

(defun mail-signature nil "\
Sign letter with contents of ~/.signature file." (interactive) (byte-code "db!!)" [nil insert-file-contents expand-file-name "~/.signature"] 3))

(defun mail-fill-yanked-message (&optional justifyp) "\
Fill the paragraphs of a message yanked into this one.
Numeric argument means justify as well." (interactive "P") (byte-code "ebQ#`d$)" [mail-header-separator nil t justifyp search-forward "
" fill-individual-paragraphs] 6))

(defun mail-yank-original (arg) "\
Insert the message being replied to, if any (in rmail).
Puts point before the text and mark after.
Indents each nonblank line ARG spaces (default 3).
Just \\[universal-argument] as argument means don't indent
and don't delete any header fields." (interactive "P") (byte-code "È;`!!
:Â/	 \"	 
!.# l?:c)" [mail-reply-buffer start arg nil delete-windows-on insert-buffer mail-yank-clear-headers mark indent-rigidly prefix-numeric-value 3 exchange-point-and-mark 10] 10))

(defun mail-yank-clear-headers (start end) (byte-code "b	#4`\"b#)3 `!!`\"))" [start end t case-fold-search mail-yank-ignored-headers nil search-forward "

" narrow-to-region re-search-forward beginning-of-line delete-region "
[^ 	]" forward-char -1] 10))

(defun mail (&optional noerase to subject in-reply-to cc replybuffer) "\
Edit a message to be sent.  Argument means resume editing (don't erase).
Returns with message buffer selected; value t if message freshly initialized.
While editing message, type C-c C-c to send the message and exit.

Separate names of recipients with commas.

Various special commands starting with C-c are available in sendmail mode
to move to message header fields:

If mail-self-blind is non-nil, a BCC to yourself is inserted
when the message is initialized.

If mail-default-reply-to is non-nil, it should be an address (a string);
a Reply-to: field with that address is inserted.

If mail-archive-file-name is non-nil, an FCC field with that file name
is inserted.

If mail-setup-hook is bound, its value is called with no arguments
after the message is initialized.  It can add more default fields.

When calling from a program, the second through fifth arguments
 TO, SUBJECT, IN-REPLY-TO and CC specify if non-nil
 the initial contents of those header fields.
 These arguments should not have final newlines.
The sixth argument REPLYBUFFER is a buffer whose contents
 should be yanked if the user types C-c C-y." (interactive "P") (byte-code "Ɉ!!	! 
?2 ?!!2 
%ȇ" [default-directory auto-save-default noerase to subject in-reply-to cc replybuffer t nil switch-to-buffer "*mail*" expand-file-name "~/" auto-save-mode mail-mode buffer-modified-p y-or-n-p "Unsent message being composed; erase it? " erase-buffer mail-setup] 13))

(defun mail-other-window (&optional noerase to subject in-reply-to cc replybuffer) "\
Like `mail' command, but display mail buffer in another window." (interactive "P") (byte-code "Ȉ!)
&" [pop-up-windows t noerase to subject in-reply-to cc replybuffer nil pop-to-buffer "*mail*" mail] 8))