From: Pankaj Jangid <pankaj@codeisgreat.org>
To: Jeremie Juste <juste@inspiring-development.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: gnus with multiple mail accounts
Date: Fri, 16 Oct 2020 12:12:35 +0530 [thread overview]
Message-ID: <m27drqacys.fsf@codeisgreat.org> (raw)
In-Reply-To: <87tuuvdvky.fsf@freegnu.i-did-not-set--mail-host-address--so-tickle-me> (Jeremie Juste's message of "Thu, 15 Oct 2020 23:32:13 +0200")
Jeremie Juste <juste@inspiring-development.com> writes:
> I would like send mail from more than one mail account from gnus.
> I tried to use X-Message-SMTP-Method (info "(gnus) Posting Styles")
> but I don't know how to change the smtpmail-stream-type.
I am using the same trick and it is working fine in my
setup. i.e. setting X-Message-SMTP-Method field is enough.
>
> So I have come up with the following function. I only need to automate
> it to do the right assignment depending on which group I'm in. Do you
> have any lead please?
To automate it, you may call your method in ‘message-setup-hook’. It
should work with ‘message-header-setup-hook’ as well.
In my case, I am reading SMTP settings from a file where I have kept
mappings like this:
#+begin_src emacs-lisp
;;; -*- lisp-data -*-
(("my@gmail.com"
.
"smtp smtp.gmail.com 587 my@gmail.com")
("my@outlook.com"
.
"smtp smtp.office365.com 587 my@outlook.com"))
#+end_src
And in my version of (set-smtp)
#+begin_src emacs-lisp
(defun my/set-smtp ()
"Set SMTP field as per FROM field."
(interactive)
(progn
(declare-function message-add-header "message.el")
(message-add-header
(concat "X-Message-SMTP-Method: "
(my/get-smtp)))))
#+end_src
(my/get-smtp) fetches the right SMTP depending upon the "From"
field. But when I invoke it in ‘message-header-setup-hook’ it throws
error because the "from" field is not yet set. So I am calling it via
‘message-setup-hook’, which is triggered as the first thing before
making any changes in the body.
prev parent reply other threads:[~2020-10-16 6:42 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-15 21:32 gnus with multiple mail accounts Jeremie Juste
2020-10-16 1:12 ` Eric Abrahamsen
2020-10-16 7:24 ` Jeremie Juste
2020-10-16 8:50 ` Robert Pluim
2020-10-16 10:15 ` Robert Pluim
2020-10-16 10:38 ` Pankaj Jangid
2020-10-16 15:54 ` Eric S Fraga
2020-10-16 16:09 ` Robert Pluim
2020-10-16 20:19 ` Jeremie Juste
2020-10-17 6:30 ` Pankaj Jangid
2020-10-17 11:45 ` Eric S Fraga
2020-10-18 17:35 ` Robert Pluim
2020-10-16 6:42 ` Pankaj Jangid [this message]
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=m27drqacys.fsf@codeisgreat.org \
--to=pankaj@codeisgreat.org \
--cc=help-gnu-emacs@gnu.org \
--cc=juste@inspiring-development.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).