unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* changing smtp server and signature depending on from address
@ 2022-04-20  9:35 alan.schmitt
  2022-04-20 10:15 ` Dan Čermák
  2022-04-25 22:14 ` João Pedro
  0 siblings, 2 replies; 5+ messages in thread
From: alan.schmitt @ 2022-04-20  9:35 UTC (permalink / raw)
  To: notmuch


[-- Attachment #1.1: Type: text/plain, Size: 407 bytes --]

Hello,

I use several email addresses, and I would like to customize the smtp
server and the signature I use for each of them. Is there a notmuch way
of doing this? I’ve looked at
https://www.emacswiki.org/emacs/SendingMail#SmtpMail and I see that I
can set a particular header to set the smtp server, but I don’t know if
there is a feature like gnus posting styles in notmuch.

Best,

Alan

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 528 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



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

* Re: changing smtp server and signature depending on from address
  2022-04-20  9:35 changing smtp server and signature depending on from address alan.schmitt
@ 2022-04-20 10:15 ` Dan Čermák
  2022-04-20 12:37   ` Alan Schmitt
  2022-04-25 22:14 ` João Pedro
  1 sibling, 1 reply; 5+ messages in thread
From: Dan Čermák @ 2022-04-20 10:15 UTC (permalink / raw)
  To: alan.schmitt, notmuch

Hi Alan,

alan.schmitt@polytechnique.org writes:

> Hello,
>
> I use several email addresses, and I would like to customize the smtp
> server and the signature I use for each of them. Is there a notmuch way
> of doing this? I’ve looked at
> https://www.emacswiki.org/emacs/SendingMail#SmtpMail and I see that I
> can set a particular header to set the smtp server, but I don’t know if
> there is a feature like gnus posting styles in notmuch.

I use gnus-alias for something like that:
--8<---------------cut here---------------start------------->8---
(use-package gnus-alias
  :ensure t
  :after notmuch
  :commands (gnus-alias-determine-identity)
  :hook ((message-setup . gnus-alias-determine-identity))
  :bind (:map notmuch-message-mode-map
              ("C-c i" . gnus-alias-select-identity))
  :config
  (setq
   gnus-alias-default-identity "default"
   gnus-alias-overlay-identities t
   gnus-alias-override-user-mail-address t
   gnus-alias-identity-alist
   '(("default"
      nil ;; Does not refer to any other identity
      "Dan Čermák <*snip*>" ;; From Header
      nil ;; Organization header
      (("Fcc" . "*snip*/sent-mail")) ;; List of extra headers
      nil ;; No extra body text
      nil ;; Signature
      )
     ("posteo"
      nil
      "Dan Čermák <dan.cermak@posteo.net>"
      nil
      (("Fcc" . "posteo/Sent"))
      nil
      nil
      ))

   gnus-alias-identity-rules
   '(("personal-redacted" ("any" "snip*" both) "default")
     ("personal-posteo" ("any" "dan.cermak@posteo.net" both) "posteo"))))
--8<---------------cut here---------------end--------------->8---


Hope this helps,

Dan\r

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

* Re: changing smtp server and signature depending on from address
  2022-04-20 10:15 ` Dan Čermák
@ 2022-04-20 12:37   ` Alan Schmitt
  0 siblings, 0 replies; 5+ messages in thread
From: Alan Schmitt @ 2022-04-20 12:37 UTC (permalink / raw)
  To: Dan Čermák, notmuch


[-- Attachment #1.1: Type: text/plain, Size: 335 bytes --]

Hi Dan,

On 2022-04-20 10:15, Dan Čermák <dan.cermak@posteo.net> writes:

> I use gnus-alias for something like that:

Thank you for suggesting gnus-alias, it looks like a great fit.

Best,

Alan

-- 
Pour une évaluation indépendante, transparente et rigoureuse !
Je soutiens la Commission d'Évaluation de l'INRIA.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 528 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



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

* Re: changing smtp server and signature depending on from address
  2022-04-20  9:35 changing smtp server and signature depending on from address alan.schmitt
  2022-04-20 10:15 ` Dan Čermák
@ 2022-04-25 22:14 ` João Pedro
  2022-04-26  5:54   ` Alan Schmitt
  1 sibling, 1 reply; 5+ messages in thread
From: João Pedro @ 2022-04-25 22:14 UTC (permalink / raw)
  To: alan.schmitt, notmuch

On 20 April 2022 11:35, alan.schmitt@polytechnique.org wrote:

> Hello,

Hi Alan!

> I use several email addresses, and I would like to customize the smtp
> server and the signature I use for each of them. Is there a notmuch way
> of doing this?

I don't think notmuch has a built-in/default way of doing it, but
notmuch itself recommends using gnus-alias [1], like others have
recommended.

I myself have come up with my own system, which gets the information for
the addresses from auth-source [2]. It basically consists on an alist
that assigns an "alias" for each address and holds its information as a
plist. So, assuming I have a personal and work accounts, the alist would
be something like

  ((personal
    (:address . "jpedrodeamorim@gmail.com")
    (:name . "João Pedro")
    (:host . "smtp.gmail.com")
    (:key . "p")
    (:signature . "João Pedro de Amorim Paula
IT undergraduate at Universidade Federal do Rio Grande do Norte (UFRN)"))
   (work
    (:address . "jpedrodeamorim@work.com")
    (:name . "João Pedro")
    (:host . "smtp.gmail.com")
    (:key . "w")
    (:signature . "João Pedro de Amorim Paula
Clojure(Script) engineer at Flexiana")))

The :key is something I assign by hand to each of my mail addresses, and
which I use to quickly choose with a single character using read-answer
[3].

I also have a couple of helper functions to correctly infer the account
I am using, and the information that smtpmail [4] needs to send my
e-mails (they are also store in auth-source, no sensitive information is
stored in plain text).

If you're interested, I could follow up on this thread detailing a
little more of how I glue it all together (by "it" I mean notmuch and
Emacs built-in Message and mail libraries), with the functions I use and
all. It currently isn't available in a public repo because I still have
some sensitive information that I need to have cryptographed before
doing so.

[1] https://notmuchmail.org/emacstips/#index16h2

[2] https://www.gnu.org/software/emacs/manual/html_mono/auth.html

[3] https://www.gnu.org/software/emacs/manual/html_node/elisp/Multiple-Queries.html

[4] https://www.gnu.org/software/emacs/manual/html_mono/smtpmail.html

-- 
João Pedro de Amorim Paula
IT undergraduate at Universidade Federal do Rio Grande do Norte (UFRN)\r

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

* Re: changing smtp server and signature depending on from address
  2022-04-25 22:14 ` João Pedro
@ 2022-04-26  5:54   ` Alan Schmitt
  0 siblings, 0 replies; 5+ messages in thread
From: Alan Schmitt @ 2022-04-26  5:54 UTC (permalink / raw)
  To: João Pedro, notmuch


[-- Attachment #1.1: Type: text/plain, Size: 404 bytes --]

Hi,

On 2022-04-25 19:14, João Pedro <jpedrodeamorim@gmail.com> writes:

> I myself have come up with my own system, which gets the information for
> the addresses from auth-source [2]. It basically consists on an alist
> that assigns an "alias" for each address and holds its information as a
> plist.

This looks very nice, thank you for sharing. I’ll experiment with it.

Best,

Alan

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 528 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



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

end of thread, other threads:[~2022-04-26  6:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-20  9:35 changing smtp server and signature depending on from address alan.schmitt
2022-04-20 10:15 ` Dan Čermák
2022-04-20 12:37   ` Alan Schmitt
2022-04-25 22:14 ` João Pedro
2022-04-26  5:54   ` Alan Schmitt

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

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).