Giter Site home page Giter Site logo

Comments (10)

jeremy-compostella avatar jeremy-compostella commented on May 20, 2024

Hi,

The <div>...</div> should be present because:

  1. with the gnus mail user agent this is added by the gnus-article-browse-html-article

  2. with mu4e Mail User Agent, the org-msg-save-article-for-reply-mu4e function should have added the <div>...</div> (see below).

    326 (defun org-msg-save-article-for-reply-mu4e ()
    327 "Export the currently visited mu4e article as HTML."
    328 (with-current-buffer mu4e~view-buffer-name
    329 (let* ((msg (mu4e-message-at-point))
    330 (html (mu4e-message-field msg :body-html))
    331 (file (concat "/tmp/" (mu4e-message-field msg :message-id))))
    332 (cl-flet* ((mails2str (l)
    333 (mapconcat (lambda (m)
    334 (format "%S <%s>" (car m) (cdr m)))
    335 l ", "))
    336 (field2str (f)
    337 (let ((value (funcall (cdr f)
    338 (mu4e-message-field msg (car f)))))
    339 (when value
    340 (format "%s: %s
    \n"
    341 (capitalize (substring (symbol-name (car f)) 1))
    342 value)))))
    343 (with-temp-buffer
    344 (save-excursion
    345 (insert html))
    346 ;; Remove everything before html tag
    347 (save-excursion
    348 (when (re-search-forward "^<html\(.?\)>" nil t)
    349 (delete-region (point-min) (match-beginning 0))))
    350 ;; Insert reply header after body tag
    351 (when (re-search-forward "<body\(.
    ?\)>" nil t)
    352 (goto-char (match-end 0))
    353 (insert "<div align="left">\n"
    354 (mapconcat #'field2str
    355 `((:from . ,#'mails2str)
    356 (:subject . identity)
    357 (:to . ,#'mails2str)
    358 (:cc . ,#'mails2str)
    359 (:date . message-make-date))
    360 "")
    361 "\n


    \n"))
    362 (write-file file))
    363 (list file)))))

Unless you are trying to answer an non-HTML email but in that case the org-msg-edit-mode should not even enable itself. Otherwise, we are left with:

  1. the original email is malformed
  2. there is a bug in org-msg-save-article-for-reply-mu4e or the error management is not strong enough (which is certainly the case but I am not the original author of this function).

If this #2, please share send me the file by email so that I can try to fix this function.

FYI, I use the gnus backend ⇒ I don't exercise the mu4e myself but many people around the world are using it.

Regards,

-- Jeremy
One Emacs to rule them all

from org-msg.

gyhor avatar gyhor commented on May 20, 2024

Hi,
thanks for the fast response. The original message is generated from a ticket system (Request Tracker).
The mime part with html is this:

------------=_1574156543-7237-6
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-RT-Original-Encoding: utf-8

<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dutf-8">Ko=
mmentar zu <a href=3D"*snip*">Ti=
cket 34708</a>:<br><br>
*snip* some text with <br> tags

------------=_1574156543-7237-6--

org-msg saves the reply file in /tmp like above - without any

surrounding. I wil try to debug 'org-msg-save-article-for-reply-mu4e'.

I receive a lot oh html mails from ticket-systems where only a html-part is included - without or tags.
Maybe org-msg does have a workaround for that?

regards

from org-msg.

jeremy-compostella avatar jeremy-compostella commented on May 20, 2024

Hi,

It looks like an invalid html content to me. I don't even see the html or body tag. Also it looks like base64 encorded mime content. The file extracted by mu4e should not have fields like Content-Type:. It should be the de-encoded html content.

Regards,
Jeremy

from org-msg.

gyhor avatar gyhor commented on May 20, 2024

hi,

ah.. I see my mistake. I should it better. The mime part above is from the original mail:

------------=_1574156543-7237-6
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-RT-Original-Encoding: utf-8

<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dutf-8">Ko=
mmentar zu <a href=3D"*snip*">Ti=
cket 34708</a>:<br><br>
*snip* some text with <br> tags

------------=_1574156543-7237-6--

'org-msg-save-article-for-reply-mu4e' save that to /tmp/messageid :

<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dutf-8">Kommentar zu <a href=3D"*snip*">Ticket 34708</a>:<br><br>
*snip* some text with <br> tags

Maybe there is any workaround possible? Because that are automated Mails, where I have to reply to :/
Maybe 'org-msg-save-article-for-reply-mu4e' recognize the missing the -tag and insert it?

regards

from org-msg.

jeremy-compostella avatar jeremy-compostella commented on May 20, 2024

Hi Gyhor,

Maybe there is any workaround possible?

Of course, this is possible. I pushed two experimental patches on the experimental branch to handle this situation. Could you test them ? And also review them ?

Regards,

Jeremy
One Emacs to rule them all

from org-msg.

gyhor avatar gyhor commented on May 20, 2024

Hi Jeremy,
the firsts tests are positive. Everything is working fine. I will try more the next days.
thank you for your fast response and help!

regards

from org-msg.

jeremy-compostella avatar jeremy-compostella commented on May 20, 2024

Hi Gyhor,

Take your time, try to validate with as many use-cases as possible, we are not in a hurry. Come back to me sometime next week with your feedback. If you do not find any issue, I will push experimental as the new master.

Regards,
Jeremy

from org-msg.

jeremy-compostella avatar jeremy-compostella commented on May 20, 2024

Is it stable enough ?

from org-msg.

jeremy-compostella avatar jeremy-compostella commented on May 20, 2024

I assume that it works now. I have pushed the experimental branch as the new master branch.

from org-msg.

gyhor avatar gyhor commented on May 20, 2024

thank you!

from org-msg.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.