* gnus with multiple mail accounts
@ 2020-10-15 21:32 Jeremie Juste
2020-10-16 1:12 ` Eric Abrahamsen
2020-10-16 6:42 ` Pankaj Jangid
0 siblings, 2 replies; 13+ messages in thread
From: Jeremie Juste @ 2020-10-15 21:32 UTC (permalink / raw)
To: help-gnu-emacs
Hello,
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.
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?
(defun set-smtp (arg)
"switch mail server"
(interactive "p")
(if (eq arg 1)
(setq message-send-mail-function 'smtpmail-send-it
smtpmail-default-smtp-server "smtp.office365.com"
smtpmail-smtp-server "smtp.office365.com"
user-mail-address "<mail1.com>"
smtpmail-smtp-service 587
smtpmail-stream-type 'starttls
)
(setq message-send-mail-function 'smtpmail-send-it
smtpmail-default-smtp-server "smtp.gmail.com"
smtpmail-smtp-server "smtp.gmail.com"
user-mail-address "<mail2.gmail.com>"
smtpmail-smtp-service 465
smtpmail-stream-type 'ssl
)
))
Best regards,
--
Jeremie Juste
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: gnus with multiple mail accounts
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 6:42 ` Pankaj Jangid
1 sibling, 2 replies; 13+ messages in thread
From: Eric Abrahamsen @ 2020-10-16 1:12 UTC (permalink / raw)
To: help-gnu-emacs
Jeremie Juste <juste@inspiring-development.com> writes:
> Hello,
>
> 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.
>
>
> 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?
>
> (defun set-smtp (arg)
> "switch mail server"
> (interactive "p")
> (if (eq arg 1)
> (setq message-send-mail-function 'smtpmail-send-it
> smtpmail-default-smtp-server "smtp.office365.com"
> smtpmail-smtp-server "smtp.office365.com"
> user-mail-address "<mail1.com>"
> smtpmail-smtp-service 587
> smtpmail-stream-type 'starttls
> )
> (setq message-send-mail-function 'smtpmail-send-it
> smtpmail-default-smtp-server "smtp.gmail.com"
> smtpmail-smtp-server "smtp.gmail.com"
> user-mail-address "<mail2.gmail.com>"
> smtpmail-smtp-service 465
> smtpmail-stream-type 'ssl
> )
> ))
Are you sure it doesn't work just to set host and port in the
pseudo-header? Looking at the code, it ought to be setting
`smtpmail-stream-type' correctly from the port. I assume you've tried
that and it didn't work?
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: gnus with multiple mail accounts
2020-10-15 21:32 gnus with multiple mail accounts Jeremie Juste
2020-10-16 1:12 ` Eric Abrahamsen
@ 2020-10-16 6:42 ` Pankaj Jangid
1 sibling, 0 replies; 13+ messages in thread
From: Pankaj Jangid @ 2020-10-16 6:42 UTC (permalink / raw)
To: Jeremie Juste; +Cc: help-gnu-emacs
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.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: gnus with multiple mail accounts
2020-10-16 1:12 ` Eric Abrahamsen
@ 2020-10-16 7:24 ` Jeremie Juste
2020-10-16 8:50 ` Robert Pluim
1 sibling, 0 replies; 13+ messages in thread
From: Jeremie Juste @ 2020-10-16 7:24 UTC (permalink / raw)
To: Eric Abrahamsen; +Cc: help-gnu-emacs
Hello,
Many thanks for the reply. Yes I tried something like the following.
(setq gnus-posting-styles
'(
("test"
("X-Message-SMTP-Method" "smtp smtp.office365.com 587")
)))
The mail didn't go through. I had a cryptic error message: gnutls-e-invalid-session.
Best regards,
Jeremie
>
> Are you sure it doesn't work just to set host and port in the
> pseudo-header? Looking at the code, it ought to be setting
> `smtpmail-stream-type' correctly from the port. I assume you've tried
> that and it didn't work?
>
--
Jeremie Juste
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: gnus with multiple mail accounts
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
` (2 more replies)
1 sibling, 3 replies; 13+ messages in thread
From: Robert Pluim @ 2020-10-16 8:50 UTC (permalink / raw)
To: Eric Abrahamsen; +Cc: help-gnu-emacs
>>>>> On Thu, 15 Oct 2020 18:12:08 -0700, Eric Abrahamsen <eric@ericabrahamsen.net> said:
Eric> Jeremie Juste <juste@inspiring-development.com> writes:
>> Hello,
>>
>> 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.
>>
>>
>> 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?
>>
>> (defun set-smtp (arg)
>> "switch mail server"
>> (interactive "p")
>> (if (eq arg 1)
>> (setq message-send-mail-function 'smtpmail-send-it
>> smtpmail-default-smtp-server "smtp.office365.com"
>> smtpmail-smtp-server "smtp.office365.com"
>> user-mail-address "<mail1.com>"
>> smtpmail-smtp-service 587
>> smtpmail-stream-type 'starttls
>> )
>> (setq message-send-mail-function 'smtpmail-send-it
>> smtpmail-default-smtp-server "smtp.gmail.com"
>> smtpmail-smtp-server "smtp.gmail.com"
>> user-mail-address "<mail2.gmail.com>"
>> smtpmail-smtp-service 465
>> smtpmail-stream-type 'ssl
>> )
>> ))
Eric> Are you sure it doesn't work just to set host and port in the
Eric> pseudo-header? Looking at the code, it ought to be setting
Eric> `smtpmail-stream-type' correctly from the port. I assume you've tried
Eric> that and it didn't work?
Thatʼs a very recent change in emacs-master, and it only work if you're
using the SMTP TLS transport port, which is 465. 587 is the SMTP
STARTTLS submission port, and is not covered (I recommend people use
465 whenever possible). Does office365 not support port 465?
Robert
--
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: gnus with multiple mail accounts
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
2 siblings, 0 replies; 13+ messages in thread
From: Robert Pluim @ 2020-10-16 10:15 UTC (permalink / raw)
To: Jeremie Juste; +Cc: Eric Abrahamsen, help-gnu-emacs
>>>>> On Fri, 16 Oct 2020 10:50:16 +0200, Robert Pluim <rpluim@gmail.com> said:
Eric> Are you sure it doesn't work just to set host and port in the
Eric> pseudo-header? Looking at the code, it ought to be setting
Eric> `smtpmail-stream-type' correctly from the port. I assume you've tried
Eric> that and it didn't work?
Robert> Thatʼs a very recent change in emacs-master, and it only work if you're
Robert> using the SMTP TLS transport port, which is 465. 587 is the SMTP
Robert> STARTTLS submission port, and is not covered (I recommend people use
Robert> 465 whenever possible). Does office365 not support port 465?
Having looked at the code some more, Eric is right, it should all just
work, if smtpmail-stream-type is set to nil or 'starttls. The code
forces TLS for port 465, and falls back to the value of
smtpmail-stream-type otherwise, so itʼs possible you had this set to
'tls, which would explain the error message you saw.
Robert
--
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: gnus with multiple mail accounts
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
2 siblings, 0 replies; 13+ messages in thread
From: Pankaj Jangid @ 2020-10-16 10:38 UTC (permalink / raw)
To: Robert Pluim; +Cc: Eric Abrahamsen, help-gnu-emacs
Robert Pluim <rpluim@gmail.com> writes:
> Thatʼs a very recent change in emacs-master, and it only work if you're
> using the SMTP TLS transport port, which is 465. 587 is the SMTP
> STARTTLS submission port, and is not covered (I recommend people use
> 465 whenever possible). Does office365 not support port 465?
office365 doesn't support 465. I just tried it using
X-Message-SMTP-Method.
/But/ emacs went into frozen state when I tried that. There should be a
timeout for that. If it is there then it is not working. I am on
emacs-master. I had to (keyboard-quit) to cancel the operation after a
minute or so.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: gnus with multiple mail accounts
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
2 siblings, 1 reply; 13+ messages in thread
From: Eric S Fraga @ 2020-10-16 15:54 UTC (permalink / raw)
To: help-gnu-emacs
On Friday, 16 Oct 2020 at 10:50, Robert Pluim wrote:
> Thatʼs a very recent change in emacs-master, and it only work if you're
> using the SMTP TLS transport port, which is 465. 587 is the SMTP
> STARTTLS submission port, and is not covered (I recommend people use
> 465 whenever possible). Does office365 not support port 465?
I don't know how recent the change you refer to is. My Emacs is from
git a day or two ago. All my emails go through with this header:
("X-Message-SMTP-Method" "smtp outlook.office365.com 587 EMAILADDRESS")
--
Eric S Fraga via Emacs 28.0.50 & org 9.4 on Debian bullseye/sid
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: gnus with multiple mail accounts
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 11:45 ` Eric S Fraga
0 siblings, 2 replies; 13+ messages in thread
From: Robert Pluim @ 2020-10-16 16:09 UTC (permalink / raw)
To: Eric S Fraga; +Cc: help-gnu-emacs
>>>>> On Fri, 16 Oct 2020 16:54:39 +0100, Eric S Fraga <e.fraga@ucl.ac.uk> said:
Eric> On Friday, 16 Oct 2020 at 10:50, Robert Pluim wrote:
>> Thatʼs a very recent change in emacs-master, and it only work if you're
>> using the SMTP TLS transport port, which is 465. 587 is the SMTP
>> STARTTLS submission port, and is not covered (I recommend people use
>> 465 whenever possible). Does office365 not support port 465?
Eric> I don't know how recent the change you refer to is. My Emacs is from
Eric> git a day or two ago. All my emails go through with this header:
Eric> ("X-Message-SMTP-Method" "smtp outlook.office365.com 587 EMAILADDRESS")
Yes, but I bet you haven't set smtpmail-stream-type, which means itʼs
nil, which means 'use STARTTLS if possible'. You might want to set it
to 'starttls.
Iʼm stunned that office365 doesnʼt support direct TLS on 465, it
leaves all their customers open to STARTTLS downgrade attaccks.
Robert
--
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: gnus with multiple mail accounts
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
1 sibling, 1 reply; 13+ messages in thread
From: Jeremie Juste @ 2020-10-16 20:19 UTC (permalink / raw)
To: help-gnu-emacs
Hello,
Many thanks everyone for sharing. I can confirm that the following
configuration works
("X-Message-SMTP-Method" "smtp outlook.office365.com 587 EMAILADDRESS")
provided that smtpmail-stream-type is set to nil (setq smtpmail-stream-type nil)
(setq gnus-posting-styles
'(
(".*"
("X-Message-SMTP-Method" "smtp smtp.gmail.com 465 <EmailAddress>")
)
("other" ;
("X-Message-SMTP-Method" "smtp smtp.office365.com 587 <EmailAddress>")
)))
Best regards,
Jeremie
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: gnus with multiple mail accounts
2020-10-16 20:19 ` Jeremie Juste
@ 2020-10-17 6:30 ` Pankaj Jangid
0 siblings, 0 replies; 13+ messages in thread
From: Pankaj Jangid @ 2020-10-17 6:30 UTC (permalink / raw)
To: Jeremie Juste; +Cc: help-gnu-emacs
Jeremie Juste <jeremiejuste@gmail.com> writes:
> I can confirm that the following configuration works
>
> ("X-Message-SMTP-Method" "smtp outlook.office365.com 587
> EMAILADDRESS")
>
> provided that smtpmail-stream-type is set to nil (setq
> smtpmail-stream-type nil)
And that is the default setting for smtpmail-stream-type.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: gnus with multiple mail accounts
2020-10-16 16:09 ` Robert Pluim
2020-10-16 20:19 ` Jeremie Juste
@ 2020-10-17 11:45 ` Eric S Fraga
2020-10-18 17:35 ` Robert Pluim
1 sibling, 1 reply; 13+ messages in thread
From: Eric S Fraga @ 2020-10-17 11:45 UTC (permalink / raw)
To: help-gnu-emacs
On Friday, 16 Oct 2020 at 18:09, Robert Pluim wrote:
> Yes, but I bet you haven't set smtpmail-stream-type, which means itʼs
> nil, which means 'use STARTTLS if possible'. You might want to set it
> to 'starttls.
Actually, I do have smtpmail-stream-type set to 'starttls.
--
Eric S Fraga via Emacs 28.0.50 & org 9.4 on Debian bullseye/sid
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: gnus with multiple mail accounts
2020-10-17 11:45 ` Eric S Fraga
@ 2020-10-18 17:35 ` Robert Pluim
0 siblings, 0 replies; 13+ messages in thread
From: Robert Pluim @ 2020-10-18 17:35 UTC (permalink / raw)
To: Eric S Fraga; +Cc: help-gnu-emacs
>>>>> On Sat, 17 Oct 2020 12:45:41 +0100, Eric S Fraga <e.fraga@ucl.ac.uk> said:
Eric> On Friday, 16 Oct 2020 at 18:09, Robert Pluim wrote:
>> Yes, but I bet you haven't set smtpmail-stream-type, which means itʼs
>> nil, which means 'use STARTTLS if possible'. You might want to set it
>> to 'starttls.
Eric> Actually, I do have smtpmail-stream-type set to 'starttls.
Good. That means office365 at least supports a small amount of
security :-)
Robert
--
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2020-10-18 17:35 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.