[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: |
Thu, 05 Sep 2024 21:49:29 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Björn Bidar <bjorn.bidar@thaodan.de> writes:
Hi Björn,
>> (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)
>
> This setting is redundant. Message-mode will use the right function
> based on the variable below.
>
>> (setq send-mail-function #'smtpmail-send-it)
>>
>> (setq smtpmail-debug-info t)
>> (setq smtpmail-stream-type 'ssl)
I think I've tried about a dozen different combinations before
finding a working setup. I also realized I had a typo and was using
the wrong port (578 instead of the correct 587). Additionally, I
found that setting smtpmail-stream-type to either 'ssl or nil also
caused connection errors. It seems like I’ve finally got it working
as expected (yay!). Here’s the current version of my relevant code
that made Gnus do what I need:
--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")
("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)
(defun my-configure-smtp-stream-type ()
"Configure the SMTP stream type based on the current user email address."
(cond ((equal user-mail-address "egrep@protonmail.ch")
(setq smtpmail-stream-type 'ssl))
((equal user-mail-address "redacted@gmail.com")
(setq smtpmail-stream-type 'starttls))))
(add-hook 'message-send-hook #'my-configure-smtp-stream-type)
--8<-----------------cut here----------------end----------------->8--
I'm not entirely satisfied with the design, but at least it works for
now. I'd like to think more about it and would love to hear any
feedback on this approach; it feels like it could be more elegant.
> I would also set smtpmail-servers-requiring-authorization like below so
> smtpmail doesn't try to send mail without logging in first.
>
> (setopt smtpmail-servers-requiring-authorization ".*")
>
> If you use Emacs 28 or older use setq instead.
Thanks for pointing out the
`smtpmail-servers-requiring-authorization' setting. That probable
makes sense for ensuring that authentication is always enforced when
sending mail. But right now it works w/o touching this setting.
> You can find my setup for Gnus-alias below:
> https://github.com/Thaodan/emacs.d/blob/master/init.org#gnus
Thanks for the link to your configuration — I'll definitely take a
closer look at it.
--
Serghei Iakovlev
- IMAP Sending Issue with Multiple Accounts, Serghei Iakovlev, 2024/09/05
- Re: IMAP Sending Issue with Multiple Accounts, Leo Butler, 2024/09/05
- Re: IMAP Sending Issue with Multiple Accounts, Serghei Iakovlev, 2024/09/05
- Re: IMAP Sending Issue with Multiple Accounts, Björn Bidar, 2024/09/05
- Message not available
- Re: IMAP Sending Issue with Multiple Accounts,
Serghei Iakovlev <=
- Re: IMAP Sending Issue with Multiple Accounts, Leo Butler, 2024/09/05
- Re: IMAP Sending Issue with Multiple Accounts, Serghei Iakovlev, 2024/09/05
- Re: IMAP Sending Issue with Multiple Accounts, James Thomas, 2024/09/05
- Re: IMAP Sending Issue with Multiple Accounts, Serghei Iakovlev, 2024/09/05
- Re: IMAP Sending Issue with Multiple Accounts, James Thomas, 2024/09/05
- Re: IMAP Sending Issue with Multiple Accounts, James Thomas, 2024/09/05
- Re: IMAP Sending Issue with Multiple Accounts, Serghei Iakovlev, 2024/09/06
- Re: IMAP Sending Issue with Multiple Accounts, Serghei Iakovlev, 2024/09/06
- Re: IMAP Sending Issue with Multiple Accounts, Robert Pluim, 2024/09/06
- Re: IMAP Sending Issue with Multiple Accounts, Serghei Iakovlev, 2024/09/06