org-msg
org-msg copied to clipboard
question: how do I include HTML code directly in the message?
For example, I want to include a signature which is designed in HTML?
This is not an org msg question, this is an org mode question. I am sure you'll find plenty of information in the org mode documentation. You can also start with the following stack overflow link https://stackoverflow.com/questions/9920001/including-literal-html-code-in-org-mode-templates
On Thu, May 6, 2021, 8:16 PM David @.***> wrote:
For example, I want to include a signature which is designed in HTML?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jeremy-compostella/org-msg/issues/109, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMACBA6HCRSBUM3G7WBXG3TMNLQ7ANCNFSM44ITIBZA .
I thought so as well. But it seems what works in org-mode doesn't work in org-msg.
I've tried:
including:
#+INCLUDE: ~/test.html export html
end
This works in a plain org file. In org-msg, this simply disappears when previewing. This simply gets ignored. screenshot of the my test email:
However if I do
including:
#+INCLUDE: ~/test.html
end
the html code gets included in my email. screenshot of the resulting email:
And if the #+INCLUDE is used inside #+begin_signature, it works as expected.
#+begin_signature
--
*Dave Dai*
#+INCLUDE: ~/test.html export html
#+end_signature
Guss this answers my question of using HTML signature!
So same syntax not working in the body, is that a feature or bug?
So same syntax not working in the body, is that a feature or bug?
It is unexpected and it works on my end.
I have found that indentation plays a role in here. in my config, by accident I have #+begin_signature
indented a few spaces. If I use #+include
in my email body without indentation, it disappears. However if I indent it to the same level as #+begin_signature
it works.
in other words, this doesn't work
Hi xxx,
#+include: ~/xxx.html export html
#+begin_signature
Dave
#+end_signature
but this works:
Hi xxx,
#+include: ~/xxx.html export html
#+begin_signature
Dave
#+end_signature
this also works:
Hi xxx,
#+include: ~/xxx.html export html
#+begin_signature
Dave
#+end_signature
is this expected? Another thing I'd appreciate your help on is, for me the style (eg. background color) of the imported HTML is changed. My HTML signature should have grey background, but when included into org-msg, it has white background. (in this case, org-msg also behaves differnt from plain org file). For example, there is <td width="102" style="width:76.25pt;background:#5C636B;padding:0cm 5.4pt 0cm 5.4pt;height:48.6pt">
in the html file, when I C-c C-e
to preview, then check the generated html file, it became background-color:#f9f9f9
.
It is unexpected and it works on my end.
The three scenario work for me with Emacs 27.2.
Regarding the background color and as documented in README.org
you can change the CSS style via the org-msg-enforce-css
variable. You can either change this variable statically or you can use a dynamic approach as illustrated below:
(let ((color "#bbbbbb")
(signature (caddr (cl-find 'signature org-msg-enforce-css :key 'cadr))))
(if-let ((cur (assq 'background signature)))
(setcdr cur color)
(setcdr (last signature) `((background . ,color)))))