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: Xiyue Deng
Subject: Re: IMAP Sending Issue with Multiple Accounts
Date: Thu, 05 Sep 2024 10:29:24 -0700
User-agent: mu4e 1.12.6; emacs 29.4

Serghei Iakovlev via "Announcements and discussions for GNUS, the GNU Emacs 
Usenet newsreader (in English)" <info-gnus-english@gnu.org> writes:

> 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 "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")
>          ("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 "egrep@protonmail.ch")
>          (message "=== sending via proton ===")
>          (setq smtpmail-smtp-server "127.0.0.1")
>          (setq smtpmail-smtp-service 1025))
>         ((equal user-mail-address "redacted@gmail.com")
>          (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.

According to the Emacs docs on X-Message-SMTP-Method[1], you can specify
it like

,----
| X-Message-SMTP-Method: smtp smtp.fsf.org 587 other-user
`----

Where it "uses ‘other-user’ as the user name when authenticating. This
is handy if you have several SMTP accounts on the same server." I have
several Gmail accounts set up in Gnus and this is what works for me to
let Gmail know which account I'm trying to send from.

[1] 
https://www.gnu.org/software/emacs/manual/html_node/message/Mail-Variables.html

-- 
Xiyue Deng



reply via email to

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