unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Guidance with handling email from emacs
@ 2023-09-20 15:56 Bruno Victal
  2023-09-21  7:14 ` Eshel Yaron
  2023-09-23  9:17 ` James Thomas
  0 siblings, 2 replies; 8+ messages in thread
From: Bruno Victal @ 2023-09-20 15:56 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

I'm attempting to move from Thunderbird to Emacs for handling my email
and would like some guidance with the task.
After reading the manual for Message Mode and the emacs-wiki I'm still
left with some lingering questions on how to replicate some of the
tasks and behaviors that I'm accustomed to with Thunderbird. Specifically,

* How to save drafts to an IMAP folder?
  I'm aware of `message-auto-save-directory' but this only saves
  messages to a local directory.

* Place a copy of the sent message in the IMAP Sent folder?
  I'm aware of the `mail-self-blind' variable that BCCs the mail to
  myself but I'm asking for this behavior in specific.

* Is there the equivalent of “Paste with quotation”?
  i.e. Paste contents of clipboard but with one level of quotation,
  regardless of where I copied the text from.

* How can I replicate the citation message style used in Thunderbird?
  i.e. “On 2023-09-18 07:57, _NAME_ wrote:”

* Is there a “right” way for easily handling multiple SMTP accounts (or
  identities as Thunderbird calls them)?
  The info from the emacs-wiki and the emacs manual seems a bit
  inconsistent or confusing in this matter.

* How can I omit the comment that is present in the `In-Reply-To'
  header? (as seen by BCC'ing the message to myself)
  --8<---------------cut here---------------start------------->8---
  In-Reply-To: <123456789@example.com>
  	(name's message of "Thu, 1 Jan 1970 07:00:00 -0700")
  --8<---------------cut here---------------end--------------->8---

* ^Related to the above: Can I paste something and have it automatically
  enclose with the “…cut here…” lines instead of having to mark the
  region and do `C-c M-m'?

* Is it OK to manually put a `In-Reply-To' header in the message headers
  or will this get overwritten by emacs when sending with `C-c C-c'?

* Can I override the host-name that is sent in the headers? I see:
  --8<---------------cut here---------------start------------->8---
  Received: from my-host-name (unknown [192.0.2.1])
  	  (Authenticated sender: foo@example.com)
  	  by mail.example.com (Postfix) with ESMTPSA id 0000000000;
	  Thu, 1 Jan 1970 00:00:00 +0200 (CEST)
  --8<---------------cut here---------------end--------------->8---
  Where my-host-name is the contents from /etc/hostname.


On receiving email, which emacs client would best mirror Thunderbird's
workflow? Or putting it in another way, what client fits best with an
IMAP oriented flow and allows displaying & organizing mail in IMAP
directories and can properly thread the discussions?


-- 
Thanks,
Bruno.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Guidance with handling email from emacs
  2023-09-20 15:56 Guidance with handling email from emacs Bruno Victal
@ 2023-09-21  7:14 ` Eshel Yaron
  2023-09-21  9:25   ` Robert Pluim
  2023-09-23  9:17 ` James Thomas
  1 sibling, 1 reply; 8+ messages in thread
From: Eshel Yaron @ 2023-09-21  7:14 UTC (permalink / raw)
  To: Bruno Victal; +Cc: help-gnu-emacs

Hi Bruno,

I use Gnus with multiple accounts, I don't have answers to all of your
questions, but I do for some of them:

Bruno Victal <mirai@makinata.eu> writes:

> * Place a copy of the sent message in the IMAP Sent folder?
>   I'm aware of the `mail-self-blind' variable that BCCs the mail to
>   myself but I'm asking for this behavior in specific.

I'm not sure how to configure this behavior, but I think for me this
just works.  Did you give it a try?

> * Is there the equivalent of “Paste with quotation”?
>   i.e. Paste contents of clipboard but with one level of quotation,
>   regardless of where I copied the text from.

I just yank the text I want to quote, and then type C-x r t > SPC RET.
I'm not sure if there's another bespoke way to do that.

> * How can I replicate the citation message style used in Thunderbird?
>   i.e. “On 2023-09-18 07:57, _NAME_ wrote:”

Try setting `message-citation-line-function` to
`message-insert-formatted-citation-line` and customize
`message-citation-line-format`.

> * Is there a “right” way for easily handling multiple SMTP accounts (or
>   identities as Thunderbird calls them)?

Yes, there are a couple of ways to achieve this, none of them are really
great IMO.  But the best way is to customize `message-server-alist`.
You can take a look at my email config here:
http://git.eshelyaron.com/gitweb/?p=dotfiles.git;a=blob;f=.emacs.d/lisp/esy-comm.el;hb=HEAD

> * ^Related to the above: Can I paste something and have it automatically
>   enclose with the “…cut here…” lines instead of having to mark the
>   region and do `C-c M-m'?

I just type C-c M-m after pasting something.  Note that you don't need
to manually select the region, Emacs puts the mark before the inserted
text automatically.

> * Can I override the host-name that is sent in the headers? I see:
>   --8<---------------cut here---------------start------------->8---
>   Received: from my-host-name (unknown [192.0.2.1])
>         (Authenticated sender: foo@example.com)
>         by mail.example.com (Postfix) with ESMTPSA id 0000000000;
>         Thu, 1 Jan 1970 00:00:00 +0200 (CEST)
>   --8<---------------cut here---------------end--------------->8---
>   Where my-host-name is the contents from /etc/hostname.

Yes, I think customizing `mail-host-address` or `message-user-fqdn`
should do the trick.


Regards,

Eshel



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Guidance with handling email from emacs
  2023-09-21  7:14 ` Eshel Yaron
@ 2023-09-21  9:25   ` Robert Pluim
  2023-09-21 15:21     ` Eric Abrahamsen
  2023-09-26 19:57     ` Björn Bidar
  0 siblings, 2 replies; 8+ messages in thread
From: Robert Pluim @ 2023-09-21  9:25 UTC (permalink / raw)
  To: Eshel Yaron; +Cc: Bruno Victal, help-gnu-emacs


>>>>> On Thu, 21 Sep 2023 09:14:22 +0200, Eshel Yaron <me@eshelyaron.com> said:

    Eshel> Bruno Victal <mirai@makinata.eu> writes:

    >> * Place a copy of the sent message in the IMAP Sent folder?
    >> I'm aware of the `mail-self-blind' variable that BCCs the mail to
    >> myself but I'm asking for this behavior in specific.

You can in theory set `gnus-message-archive-group' to point at an IMAP
folder like "nnimap+myimapserver:Sent", but Iʼve never tried it (see
also `gnus-gcc-mark-as-read').

    Eshel> I'm not sure how to configure this behavior, but I think for me this
    Eshel> just works.  Did you give it a try?

gmail does it for you automatically, that I know.

    >> * Is there the equivalent of “Paste with quotation”?
    >> i.e. Paste contents of clipboard but with one level of quotation,
    >> regardless of where I copied the text from.

    Eshel> I just yank the text I want to quote, and then type C-x r t > SPC RET.
    Eshel> I'm not sure if there's another bespoke way to do that.

Thereʼs `message-yank-buffer', but see below.

    >> * How can I replicate the citation message style used in Thunderbird?
    >> i.e. “On 2023-09-18 07:57, _NAME_ wrote:”

    Eshel> Try setting `message-citation-line-function` to
    Eshel> `message-insert-formatted-citation-line` and customize
    Eshel> `message-citation-line-format`.

Or take a look at the "supercite" package (I used it for this message).

    >> * Is there a “right” way for easily handling multiple SMTP accounts (or
    >> identities as Thunderbird calls them)?

    Eshel> Yes, there are a couple of ways to achieve this, none of them are really
    Eshel> great IMO.  But the best way is to customize `message-server-alist`.
    Eshel> You can take a look at my email config here:
    Eshel> http://git.eshelyaron.com/gitweb/?p=dotfiles.git;a=blob;f=.emacs.d/lisp/esy-comm.el;hb=HEAD

Iʼve used `gnus-posting-styles' for this in the past. something like

(setq gnus-posting-styles
      '(
        ("^nnimap\\+gmail"
         (address "myusername@gmail.com")
         ("X-Message-SMTP-Method" "smtp mail.gmail.com smtps myusername"))
        ("^nnimap\\+yahoo"
         (address "myusername@yahoo.com")
         ("X-Message-SMTP-Method" "smtp mail.yahoo.com smtps myusername"))))

(this also sets "From" for you based on the group youʼre in)

    >> * ^Related to the above: Can I paste something and have it automatically
    >> enclose with the “…cut here…” lines instead of having to mark the
    >> region and do `C-c M-m'?

Yes. See `yank-transform-functions', which you could also use to do
the quoting you talked about earlier. Of course this is Emacs, so you
can always define your own functions to do different kinds of yanking
and bind them to keys of your choosing.

Robert
-- 



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Guidance with handling email from emacs
  2023-09-21  9:25   ` Robert Pluim
@ 2023-09-21 15:21     ` Eric Abrahamsen
  2023-09-26 19:57     ` Björn Bidar
  1 sibling, 0 replies; 8+ messages in thread
From: Eric Abrahamsen @ 2023-09-21 15:21 UTC (permalink / raw)
  To: help-gnu-emacs

Robert Pluim <rpluim@gmail.com> writes:

>>>>>> On Thu, 21 Sep 2023 09:14:22 +0200, Eshel Yaron <me@eshelyaron.com> said:
>
>     Eshel> Bruno Victal <mirai@makinata.eu> writes:
>
>     >> * Place a copy of the sent message in the IMAP Sent folder?
>     >> I'm aware of the `mail-self-blind' variable that BCCs the mail to
>     >> myself but I'm asking for this behavior in specific.
>
> You can in theory set `gnus-message-archive-group' to point at an IMAP
> folder like "nnimap+myimapserver:Sent", but Iʼve never tried it (see
> also `gnus-gcc-mark-as-read').

This works for me. You can set it in your posting styles, or I do it in
the select method definition. That means you have to start composing new
messages using a prefix argument on the group whose settings you want to
pick up, but that's never seemed like too much of a burden to me. There
are also several packages managing higher-level account settings.




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Guidance with handling email from emacs
  2023-09-20 15:56 Guidance with handling email from emacs Bruno Victal
  2023-09-21  7:14 ` Eshel Yaron
@ 2023-09-23  9:17 ` James Thomas
  2023-09-23  9:33   ` James Thomas
  1 sibling, 1 reply; 8+ messages in thread
From: James Thomas @ 2023-09-23  9:17 UTC (permalink / raw)
  To: Bruno Victal; +Cc: help-gnu-emacs

Bruno Victal wrote:

> * Is it OK to manually put a `In-Reply-To' header in the message headers
>   or will this get overwritten by emacs when sending with `C-c C-c'?

Then you'll probably get two headers. To edit the existing field,
customize `message-hidden-headers'.

--



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Guidance with handling email from emacs
  2023-09-23  9:17 ` James Thomas
@ 2023-09-23  9:33   ` James Thomas
  0 siblings, 0 replies; 8+ messages in thread
From: James Thomas @ 2023-09-23  9:33 UTC (permalink / raw)
  To: Bruno Victal; +Cc: help-gnu-emacs

James Thomas wrote:

> Bruno Victal wrote:
>
>> * Is it OK to manually put a `In-Reply-To' header in the message headers
>>   or will this get overwritten by emacs when sending with `C-c C-c'?
>
> Then you'll probably get two headers. To edit the existing field,
> customize `message-hidden-headers'.

Or, of course, whenever needed you could manually widen the buffer (C-x
n w) and go to the top to edit it.

--



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Guidance with handling email from emacs
  2023-09-21  9:25   ` Robert Pluim
  2023-09-21 15:21     ` Eric Abrahamsen
@ 2023-09-26 19:57     ` Björn Bidar
  2023-09-29  8:54       ` Michel Verdier
  1 sibling, 1 reply; 8+ messages in thread
From: Björn Bidar @ 2023-09-26 19:57 UTC (permalink / raw)
  To: Robert Pluim; +Cc: Eshel Yaron, Bruno Victal, help-gnu-emacs

Robert Pluim <rpluim@gmail.com> writes:

>     >> * Is there a “right” way for easily handling multiple SMTP accounts (or
>     >> identities as Thunderbird calls them)?
>
>     Eshel> Yes, there are a couple of ways to achieve this, none of them are really
>     Eshel> great IMO.  But the best way is to customize `message-server-alist`.
>     Eshel> You can take a look at my email config here:
>     Eshel> http://git.eshelyaron.com/gitweb/?p=dotfiles.git;a=blob;f=.emacs.d/lisp/esy-comm.el;hb=HEAD
>
> Iʼve used `gnus-posting-styles' for this in the past. something like
>
> (setq gnus-posting-styles
>       '(
>         ("^nnimap\\+gmail"
>          (address "myusername@gmail.com")
>          ("X-Message-SMTP-Method" "smtp mail.gmail.com smtps myusername"))
>         ("^nnimap\\+yahoo"
>          (address "myusername@yahoo.com")
>          ("X-Message-SMTP-Method" "smtp mail.yahoo.com smtps myusername"))))

Another option is to use gnus-alias. You can define `gnus-alias-identity-rules` to use a
different identity based on the rules e.g.

(setq gnus-alias-identity-rules
      '(("Example-Rule-name"
         ;; If the email was send To: an address from example.com
         ;; use the alias called user@example.com
         ("to" ".+@.*example.com" previous)
         "user@example.com")))

This way you can define an alias and set settings such as the smtp method:

(setq gnus-alias-identity-alist
      '(("user@example.com" ;; Alias
         "" ;; Refers-To:
         "Example User <user@example.com>" ;; To:
         "Example Org" ;; Organization
         ;; Set Gcc so mails are send in the Send folder
         ;; on the imap server example.com
         (("Gcc" . "nnimap+example.com:Sent")
          ;; Using X-Message-SMTP-Method we can tell
          ;; Emacs wich smtp server to use, doesn't depend on
          ;; gnus-alias 
          ("X-Message-SMTP-Method" .
           "smtp smtp.example.com 25 user@example.com")) ;; headers
         "" ;; Body Text
         "") ;; Signature



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Guidance with handling email from emacs
  2023-09-26 19:57     ` Björn Bidar
@ 2023-09-29  8:54       ` Michel Verdier
  0 siblings, 0 replies; 8+ messages in thread
From: Michel Verdier @ 2023-09-29  8:54 UTC (permalink / raw)
  To: help-gnu-emacs

Le 26 septembre 2023 Björn Bidar a écrit :

> This way you can define an alias and set settings such as the smtp method:

I use message-alternative-emails to use aliases in response.
I use gnus-posting-styles to setup mails for some groups.
I can then change From manually if needed (easy with TAB). And I set
X-Message-SMTP-Method only on sending mail (with smtpmail) so it takes
care of final From.



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-09-29  8:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-20 15:56 Guidance with handling email from emacs Bruno Victal
2023-09-21  7:14 ` Eshel Yaron
2023-09-21  9:25   ` Robert Pluim
2023-09-21 15:21     ` Eric Abrahamsen
2023-09-26 19:57     ` Björn Bidar
2023-09-29  8:54       ` Michel Verdier
2023-09-23  9:17 ` James Thomas
2023-09-23  9:33   ` James Thomas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).