⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sendmail.el

📁 早期freebsd实现
💻 EL
📖 第 1 页 / 共 2 页
字号:
	  (apply 'call-process-region		 (append (list (point-min) (point-max)			       (if (boundp 'sendmail-program)				   sendmail-program				 "/usr/lib/sendmail")			       nil errbuf nil			       "-oi" "-t")			 ;; Always specify who from,			 ;; since some systems have broken sendmails.			 (list "-f" (user-login-name));;;			 ;; Don't say "from root" if running under su.;;;			 (and (equal (user-real-login-name) "root");;;			      (list "-f" (user-login-name)))			 ;; These mean "report errors by mail"			 ;; and "deliver in background".			 (if (null mail-interactive) '("-oem" "-odb"))))	  (if mail-interactive	      (save-excursion		(set-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"			   (buffer-substring (point-min) (point-max)))))))      (kill-buffer tembuf)      (if (bufferp errbuf)	  (kill-buffer errbuf)))))(defun mail-do-fcc (header-end)  (let (fcc-list	(rmailbuf (current-buffer))	(tembuf (generate-new-buffer " rmail output"))	(case-fold-search t))    (save-excursion      (goto-char (point-min))      (while (re-search-forward "^FCC:[ \t]*" header-end t)	(setq fcc-list (cons (buffer-substring (point)					       (progn						 (end-of-line)						 (skip-chars-backward " \t")						 (point)))			     fcc-list))	(delete-region (match-beginning 0)		       (progn (forward-line 1) (point))))      (set-buffer tembuf)      (erase-buffer)      (insert "\nFrom " (user-login-name) " "	      (current-time-string) "\n")      (insert-buffer-substring rmailbuf)      ;; Make sure messages are separated.      (goto-char (point-max))      (insert ?\n)      (goto-char 2)      ;; ``Quote'' "^From " as ">From "      ;;  (note that this isn't really quoting, as there is no requirement      ;;   that "^[>]+From " be quoted in the same transparent way.)      (let ((case-fold-search nil))	(while (search-forward "\nFrom " nil t)	  (forward-char -5)	  (insert ?>)))      (while fcc-list	(let ((buffer (get-file-buffer (car fcc-list))))	  (if buffer	      ;; File is present in a buffer => append to that buffer.	      (let ((curbuf (current-buffer))		    (beg (point-min)) (end (point-max)))		(save-excursion		  (set-buffer buffer)		  (goto-char (point-max))		  (insert-buffer-substring curbuf beg end)))	    ;; Else append to the file directly.	    (write-region (point-min) (point-max) (car fcc-list) t)))	(setq fcc-list (cdr fcc-list))))    (kill-buffer tembuf)))(defun mail-to ()  "Move point to end of To-field."  (interactive)  (expand-abbrev)  (mail-position-on-field "To"))(defun mail-subject ()  "Move point to end of Subject-field."  (interactive)  (expand-abbrev)  (mail-position-on-field "Subject"))(defun mail-cc ()  "Move point to end of CC-field.  Create a CC field if none."  (interactive)  (expand-abbrev)  (or (mail-position-on-field "cc" t)      (progn (mail-position-on-field "to")	     (insert "\nCC: "))))(defun mail-bcc ()  "Move point to end of BCC-field.  Create a BCC field if none."  (interactive)  (expand-abbrev)  (or (mail-position-on-field "bcc" t)      (progn (mail-position-on-field "to")	     (insert "\nBCC: "))))(defun mail-position-on-field (field &optional soft)  (let (end	(case-fold-search t))    (goto-char (point-min))    (search-forward (concat "\n" mail-header-separator "\n"))    (setq end (match-beginning 0))    (goto-char (point-min))    (if (re-search-forward (concat "^" (regexp-quote field) ":") end t)	(progn	  (re-search-forward "^[^ \t]" nil 'move)	  (beginning-of-line)	  (skip-chars-backward "\n")	  t)      (or soft	  (progn (goto-char end)		 (skip-chars-backward "\n")		 (insert "\n" field ": ")))      nil)))(defun mail-signature ()  "Sign letter with contents of ~/.signature file."  (interactive)  (save-excursion    (goto-char (point-max))    (insert-file-contents (expand-file-name "~/.signature"))))(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")  (save-excursion    (goto-char (point-min))    (search-forward (concat "\n" mail-header-separator "\n") nil t)    (fill-individual-paragraphs (point)				(point-max)				justifyp				t)))(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 indentand don't delete any header fields."  (interactive "P")  (if mail-reply-buffer      (let ((start (point)))	(delete-windows-on mail-reply-buffer)	(insert-buffer mail-reply-buffer)	(if (consp arg)	    nil	  (mail-yank-clear-headers start (mark))	  (indent-rigidly start (mark)			  (if arg (prefix-numeric-value arg) 3)))	(exchange-point-and-mark)	(if (not (eolp)) (insert ?\n)))))(defun mail-yank-clear-headers (start end)  (save-excursion    (goto-char start)    (if (search-forward "\n\n" end t)	(save-restriction	  (narrow-to-region start (point))	  (goto-char start)	  (while (let ((case-fold-search t))		   (re-search-forward mail-yank-ignored-headers nil t))	    (beginning-of-line)	    (delete-region (point)			   (progn (re-search-forward "\n[^ \t]")				  (forward-char -1)				  (point))))))));; Put these last, to reduce chance of lossage from quitting in middle of loading the file.(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 modeto move to message header fields:\\{mail-mode-map}If mail-self-blind is non-nil, a BCC to yourself is insertedwhen 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 nameis inserted.If mail-setup-hook is bound, its value is called with no argumentsafter 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")  (switch-to-buffer "*mail*")  (setq default-directory (expand-file-name "~/"))  (auto-save-mode auto-save-default)  (mail-mode)  (and (not noerase)       (or (not (buffer-modified-p))	   (y-or-n-p "Unsent message being composed; erase it? "))       (progn (erase-buffer)	      (mail-setup to subject in-reply-to cc replybuffer)	      t)))(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")  (let ((pop-up-windows t))    (pop-to-buffer "*mail*"))  (mail noerase to subject in-reply-to cc replybuffer));;; Do not add anything but external entries on this page.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -