Comments (2)
The code in the README didn't work for me*, but I can share how I've set this up.
My org-msg-signature defaults to some html wrapped in export_begin html
and end_export
tags, that I keep in a file:
(setq org-msg-signature (with-current-buffer (find-file-noselect (expand-file-name ".html-signature" org-roam-directory) t) (buffer-string))))
Then I used the example code in the README to come up with the following:
(defun gjm/org-msg-signature-switch (orig-fun &rest args)
"No signature for replies. Text signature for new plain text emails."
(let ((res (apply orig-fun args))
(is-reply (not (equal (car args) 'new)))
(is-text (equal (last (cadr args)) '(text)))
(text-sig "\n\n--\nGav Massingham\nTechnology Development Officer\nCarers' Resource"))
(if is-reply (setf (alist-get 'signature res) "")
(if is-text (setf (alist-get 'signature res) text-sig)))
res))
(advice-add 'org-msg-composition-parameters
:around #'gjm/org-msg-signature-switch)
First, I set a couple of local convenience variables for whether it's a reply email, whether it's a plain text email, and to hold a basic signature for plain text emails. Then there are a couple of nested if
statements. The first check if it's a reply email, and set the signature to be empty if so, as I don't want a signature on replies. The second checks if we're sending a plain text email and sets the signature to the variable created earlier, if so.
This works for setting the signature of the message being edited.
What doesn't seem to happen is for separate text and HTML signatures to be added to the relevant parts of the message if there are both HTML and text versions (at least it doesn't for me using mu4e with org-msg). I don't know if this is the expected behaviour, or a bug. A quick scan of the code suggests the signature is only inserted once, into the buffer for editing the message. It would be good to have both versions of the signature included in emails that send both text and HTML parts, so I'll look into this further.
*because args
was set to '(new (text))
at the time, and (cadr args)
is nil
if args
is a list with a single element
from org-msg.
If you use mu4e
, you can also do this with the “contexts” function; here’s the key part from my config:
(defun mu4e-extras-set-contexts ()
"Set `mu4e-contexts'."
(setq mu4e-contexts
`(,(make-mu4e-context
:name "Personal HTML"
:match-func #'mu4e-extras-msg-is-personal-and-html-p
:vars `((user-mail-address . ,(getenv "PERSONAL_GMAIL"))
(org-msg-signature . ,org-msg-extras-personal-html-signature)))
,(make-mu4e-context
:name "Personal plain text"
:match-func #'mu4e-extras-msg-is-personal-and-plain-text-p
:vars `((user-mail-address . ,(getenv "PERSONAL_GMAIL"))
(org-msg-signature . ,org-msg-extras-personal-plain-text-signature)))
,(make-mu4e-context
:name "Work HTML"
:match-func #'mu4e-extras-msg-is-work-and-html-p
:vars `((user-mail-address . ,(getenv "WORK_EMAIL"))
(org-msg-signature . ,org-msg-extras-work-html-signature)))
,(make-mu4e-context
:name "Work plain text"
:match-func #'mu4e-extras-msg-is-work-and-plain-text-p
:vars `((user-mail-address . ,(getenv "WORK_EMAIL"))
(org-msg-signature . ,org-msg-extras-work-plain-text-signature))))))
(defun org-msg-extras-msg-is-html-p ()
"Return t iff the current message is an HTML message."
(not (null (condition-case nil
(org-msg-mua-call 'article-htmlp)
(error nil)))))
The other relevant functions are defined here.
from org-msg.
Related Issues (20)
- Problems with yanking
- Image from the signature doesn't show on receivers end when I reply to email HOT 8
- Auto indent (vertical lines) on email reply not showing
- Reply and wide reply do not invoke org-msg HOT 1
- Odd Issue with Forwarded Messages, Empty Message at Top
- Tab does not auto-complete emails in the To: field HOT 12
- Wrong cursor position after reply — missing call to `goto-body` HOT 1
- Unwanted *ORG ASCII Export* buffer HOT 5
- Forwarding email with inline image or LaTeX formula fails (reverts to text), but replying works (keeps html) HOT 1
- Customise reply/forward citation lines (currently sometimes shows several authors in From: and duplicate authors in Cc:)
- Temporary reply-to filepaths are not persisted HOT 1
- Proper way to inject css
- Documentation for org-msg-options HOT 1
- `mu` v1.11.23 breaks `org-msg` HOT 3
- inline images in parent message have the wrong content-disposition (attached) when replying HOT 1
- [Feature Request] Addressee tagging generating a mailto link in the message body HOT 2
- How to disable org-msg for org-submit-bug-report?
- `mu 1.12.0` breaks `org-msg` HOT 29
- compose error with mu4e HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from org-msg.