unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Björn Bidar" <bjorn.bidar@thaodan.de>
To: Robert Pluim <rpluim@gmail.com>
Cc: Eshel Yaron <me@eshelyaron.com>,
	 Bruno Victal <mirai@makinata.eu>,
	help-gnu-emacs@gnu.org
Subject: Re: Guidance with handling email from emacs
Date: Tue, 26 Sep 2023 22:57:21 +0300	[thread overview]
Message-ID: <87zg18btcu.fsf@thaodan.de> (raw)
In-Reply-To: <87ediryj1z.fsf@gmail.com> (Robert Pluim's message of "Thu, 21 Sep 2023 11:25:28 +0200")

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



  parent reply	other threads:[~2023-09-26 19:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2023-09-29  8:54       ` Michel Verdier
2023-09-23  9:17 ` James Thomas
2023-09-23  9:33   ` James Thomas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zg18btcu.fsf@thaodan.de \
    --to=bjorn.bidar@thaodan.de \
    --cc=help-gnu-emacs@gnu.org \
    --cc=me@eshelyaron.com \
    --cc=mirai@makinata.eu \
    --cc=rpluim@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).