help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gnus with multiple mail accounts


From: Pankaj Jangid
Subject: Re: gnus with multiple mail accounts
Date: Fri, 16 Oct 2020 12:12:35 +0530
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (darwin)

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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]