Re: changing smtp server and signature depending on from address

Subject: Re: changing smtp server and signature depending on from address

Date: Mon, 25 Apr 2022 19:14:40 -0300

To: alan.schmitt@polytechnique.org, notmuch

Cc:

From: João Pedro


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)
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: