Hi Leo,

I think I’ve already tried something similar to what you’re
suggesting. I even experimented with a specialized hook. Here’s a
cleaned-up version of my current setup:

--8<-------------------------- separator ------------------------>8--
(setq gnus-posting-styles
      `((".*"
         (signature ,user-full-name)
         (address "[email protected]")
         ("GCC" "nnimap+main:Sent")
         ("X-Message-SMTP-Method" "smtp 127.0.0.1 1025"))
        ("nnimap\\+gmail:.*"
         (address "[email protected]")
         ("GCC" "nnimap+gmail:[Gmail]/Sent Mail")
         ("X-Message-SMTP-Method" "smtp smtp.gmail.com 587"))))

(setq message-send-mail-function 'message-smtpmail-send-it)
(setq send-mail-function #'smtpmail-send-it)

(setq smtpmail-debug-info t)
(setq smtpmail-stream-type 'ssl)

;; Disabled in global scope
;; (setq smtpmail-default-smtp-server "127.0.0.1")
;; (setq smtpmail-smtp-service 1025)

(defun set-mail-transport ()
  (cond ((equal user-mail-address "[email protected]")
         (message "=== sending via proton ===")
         (setq smtpmail-smtp-server "127.0.0.1")
         (setq smtpmail-smtp-service 1025))
        ((equal user-mail-address "[email protected]")
         (message "=== sending via gmail ===")
         (setq smtpmail-smtp-server "smtp.gmail.com")
         (setq smtpmail-smtp-service 587))))

(add-hook 'message-send-hook #'set-mail-transport)
--8<-------------------------- separator ------------------------>8--

Sending via ProtonMail works perfectly fine, but when I try to send
through Gmail, it just hangs for a long time, and eventually, I get
the following:

--8<-------------------------- separator ------------------------>8--
=== sending via gmail ===
Sending...
Sending via mail...
open-network-stream: Failed connect: Operation timed out
--8<-------------------------- separator ------------------------>8--

I feel like I’m close, but there’s something still not quite
right. If you have any insights on what might be going wrong or any
tweaks I should try, I’d really appreciate it.


-- 
Serghei Iakovlev


  • ... Announcements and discussions for GNUS, the GNU Emacs Usenet newsreader (in English)
    • ... Leo Butler
      • ... Announcements and discussions for GNUS, the GNU Emacs Usenet newsreader (in English)
        • ... Xiyue Deng
          • ... Announcements and discussions for GNUS, the GNU Emacs Usenet newsreader (in English)
        • ... Björn Bidar
        • ... Announcements and discussions for GNUS, the GNU Emacs Usenet newsreader (in English)
          • ... Leo Butler
            • ... Announcements and discussions for GNUS, the GNU Emacs Usenet newsreader (in English)
              • ... James Thomas
                • ... Announcements and discussions for GNUS, the GNU Emacs Usenet newsreader (in English)
                • ... James Thomas
                • ... James Thomas

Reply via email to