info-gnus-english
[Top][All Lists]
Advanced

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

Re: IMAP Sending Issue with Multiple Accounts


From: Serghei Iakovlev
Subject: Re: IMAP Sending Issue with Multiple Accounts
Date: Fri, 06 Sep 2024 10:02:16 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

James Thomas <jimjoe@gmx.net> writes:


>> Need not be that complex, AFAICT. The method could simply be something
>> like "starttls 127.0.0.1 1025" where the only thing you would do is
>> let-bind the stream type and call the default.
>
> Well, I was wrong about this part: 'method' ought to be dynamically
> bound for just that block in the code, for this to be possible.

I need to pay more attention to the provider’s documentation and the
source code of the packages I use, rather than blindly copying
configurations from www.emacswiki.org.  It turned out to be simpler
than I thought.  My eye caught this fragment in the
`message-multi-smtp-send-mail' [1] function:

--8<-----------------cut here----------------start--------------->8--
(smtpmail-stream-type (if (= port 465)
                          'tls
                        smtpmail-stream-type))
--8<-----------------cut here----------------end----------------->8--

Then I just changed the port from 587 to 465 as follows:

--8<-----------------cut here----------------start--------------->8--
("X-Message-SMTP-Method" "smtp smtp.gmail.com 465")
--8<-----------------cut here----------------end----------------->8--

and everything started working!  I double-checked Google’s help
center, and sure enough, they offer two ports — 465 and 587 — and
depending on the port, they expect either TLS or SSL.

So, as you can guess, I completely removed my hook, and my code now
looks much cleaner:

--8<-----------------cut here----------------start--------------->8--
(setq gnus-posting-styles
      `((".*"
         (signature ,user-full-name)
         (address "egrep@protonmail.ch")
         ("GCC" "nnimap+main:Sent")
         ("X-Message-SMTP-Method" "smtp 127.0.0.1 1025"))
        ("nnimap\\+gmail:.*"
         (address "redacted@gmail.com")
         ("GCC" "nnimap+gmail:[Gmail]/Sent Mail")
         ;; For SSL 465, enter use, for TLS, use 587
         ("X-Message-SMTP-Method" "smtp smtp.gmail.com 465"))))

(setq smtpmail-servers-requiring-authorization ".*")
(setq message-send-mail-function #'message-send-mail-with-sendmail)
(setq send-mail-function #'smtpmail-send-it)

;; Will be redefined in `message-multi-smtp-send-mail' later.
(setq-default smtpmail-stream-type 'ssl)
--8<-----------------cut here----------------end----------------->8--

Thanks for nudging me to dig deeper into this!

[1] https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/gnus/message.el#n5027

-- 
Serghei Iakovlev




reply via email to

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