From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.user/18831 Path: news.gmane.org!.POSTED!not-for-mail From: Jordan Wilson Newsgroups: gmane.emacs.gnus.user Subject: Re: "Forward" in the standard way Date: Sat, 14 Apr 2018 12:38:40 +0100 Message-ID: <8736zyaugv.fsf@gmx.com> References: <87a8m2f8ra.fsf@gmx.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1523705816 26382 195.159.176.226 (14 Apr 2018 11:36:56 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 14 Apr 2018 11:36:56 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) To: info-gnus-english@gnu.org Original-X-From: info-gnus-english-bounces+gegu-info-gnus-english=m.gmane.org@gnu.org Sat Apr 14 13:36:52 2018 Return-path: Envelope-to: gegu-info-gnus-english@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f7JUA-0006h5-KX for gegu-info-gnus-english@m.gmane.org; Sat, 14 Apr 2018 13:36:50 +0200 Original-Received: from localhost ([::1]:56174 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f7JWF-0004N4-Nn for gegu-info-gnus-english@m.gmane.org; Sat, 14 Apr 2018 07:38:59 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60617) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f7JWD-0004Mp-M3 for info-gnus-english@gnu.org; Sat, 14 Apr 2018 07:38:58 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f7JWA-000556-KQ for info-gnus-english@gnu.org; Sat, 14 Apr 2018 07:38:57 -0400 Original-Received: from [195.159.176.226] (port=34818 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f7JWA-000515-BR for info-gnus-english@gnu.org; Sat, 14 Apr 2018 07:38:54 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1f7JTx-0006UG-79 for info-gnus-english@gnu.org; Sat, 14 Apr 2018 13:36:37 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 78 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:g3fidhsDzh/OfB3JEIMvcBsJ7V8= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 X-BeenThere: info-gnus-english@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Announcements and discussions for GNUS, the GNU Emacs Usenet newsreader \(in English\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: info-gnus-english-bounces+gegu-info-gnus-english=m.gmane.org@gnu.org Original-Sender: "info-gnus-english" Xref: news.gmane.org gmane.emacs.gnus.user:18831 Archived-At: --=-=-= Content-Type: text/plain On 2016-03-13 (Sun) at 20:00 (+0000), I wrote: > I have been trying to forward HTML email (*makes the sign of the > cross*). > > I want to have Gnus treat the email content "in the standard way", > i.e. have the HTML content inline (not as an attachment), and renderable > by non-Gnus email clients. > > My fiddlings with `message-forward-as-mime' and > `message-forward-show-mml' has got me as far as having the > HTML message inline, but the HTML is unrendered on the other end. > > Is there a simple way of doing this using Gnus? I completely forgot about this thread, until just now seeing Lars's reply. I ended up hacking together this very ugly function (more of a script). I imagine it would have been trivial to implement this properly, but didn't have the time to look at Gnus' internals. It works most of the time in the way that I wanted. --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=html-forward.el Content-Transfer-Encoding: quoted-printable ;; a very hack-'n'-slash way to forward HTML email in gnus (defun jordan/html-forward () (interactive) (require 'htmlize) (unless (member major-mode '(gnus-summary-mode gnus-article-mode)) (user-error "Not in a Gnus buffer")) (let (forward-header p1) (gnus-summary-mail-forward) (goto-char (point-min)) (replace-regexp "^<#mml.*>" "<#multipart type=3Dalternative>\n<#part type=3Dtext/plain>") (insert "<#part type=3Dtext/plain charset=3D\"utf-8\" disposition=3Dinl= ine nofile=3Dyes>") (next-line) (move-beginning-of-line nil) (setq p1 (point)) (search-forward-regexp "^<#multipart.*>") (setq forward-header (buffer-substring p1 (1- (match-beginning 0)))) (move-beginning-of-line nil) (replace-regexp "^<#multipart.*>" "") (replace-regexp "^<#part type=3Dtext/plain.*>" "") (replace-regexp "<#part type=3Dtext/html.*>" "<#multipart type=3Drelated><#part type=3Dtext/html>") (next-line) (move-beginning-of-line nil) (newline) (previous-line) (insert (concat "
" (htmlize-string-to-html forward-header)
		    "
")) (newline) (goto-char (point-max)) (replace-string "<#/mml>" "<#/multipart>" nil nil nil t) (end-of-line) (delete-region (point) (point-max)) (goto-char (point-min)) (when (save-excursion (goto-char (point-min)) (search-forward "=0D" nil t)) (replace-string "=0D" "")) (goto-char (point-min)) (message-goto-to))) --=-=-= Content-Type: text/plain -- Sent from Gnus v5.13, GNU Emacs 26.1 --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline