jeremy-compostella / org-msg

OrgMsg is a GNU/Emacs global minor mode mixing up Org mode and Message mode to compose and reply to emails in a Outlook HTML friendly style.
GNU General Public License v3.0
276 stars 57 forks source link

Org-Msg ignores gnus-parameters, posting-styles #135

Open danielfleischer opened 2 years ago

danielfleischer commented 2 years ago

When using Org-Msg via (org-msg-mode), when writing a new message I see that gnus-parameters are ignored. They contain posting styles, e.g. the X-Message-SMTP-Method header used to specify the SMTP details which is missing. In addition my gnus-parameters also define gnus-message-archive-group/method used to get proper sent-messages archiving on IMAP using the Gcc header, which is also missing.

Expectation: Gnus logic regarding headers should stay intact.

morganwillcock commented 2 years ago

Just to note, the setup function for Gnus posting styles is actually called; I am switching Org-Msg variables through the use of posting styles, although that is through the use of eval in the relevant posting style, and so it isn't ideal. I had to switch to programatically constructing the posting styles to help share the settings and I do have to slightly work around my signature being set for both Gnus and for Org-Msg.

It would be good to just use the posting styles as-is.

jeremy-compostella commented 2 years ago

1 could you provide a example failing case as I do not reproduce?

2 what would be the best approach to you ? Could you share how you are making use of gnus-parameter and why you think this is a better solution?

danielfleischer commented 2 years ago

Hi, as I said, I'm using gnus-parameters as a multi-account system where - based on the group I'm in - the correct SMTP server is selected and sent messages are saved in the right place, whether it's local or in an IMAP sent "folder".

The way it works is simple; it's just adding 2 headers: X-Message-SMTP-Method and Gcc to the message.

Going through the code, I see the headers "from" "subject" "to" "cc" "date" being processed; can we just leave other fields as they are?

Here is an example; there are 2 accounts with different SMTP servers and different IMAP folders used for sent messages:

(setq gnus-parameters
      '(("home"
         (gnus-message-archive-method '(nnimap "Gmail"))
         (gnus-message-archive-group "[Gmail]/Sent")
         (gnus-posting-styles
          '((".*"
             (address "<daniel@gmail.com>")
             ("X-Message-SMTP-Method" "smtp smtp.gmail.com 587 daniel@gmail.com")))))
        ("work"
         (gnus-message-archive-method '(nnimap "Work"))
         (gnus-message-archive-group "[Gmail]/Work/Sent")
         (gnus-posting-styles
          '((".*"
             (address "<daniel.WORK@work.com>")
             ("X-Message-SMTP-Method" "smtp smtp.gmail.com 587 daniel.WORK@work.com")))))))