* multiple gmail accounts: smtp and expiry
@ 2012-04-14 17:36 George McNinch
2012-04-17 12:43 ` Sivaram Neelakantan
0 siblings, 1 reply; 7+ messages in thread
From: George McNinch @ 2012-04-14 17:36 UTC (permalink / raw)
To: info-gnus-english; +Cc: ding
Hi,
To the extent that this is useful, I thought I'd share some
idea(s)/solution(s) to issues related to smtp and expiry for multiple
gmail accounts in gnus.
* expiry
I want expired mail from a gmail account to expire to the "correct"
[GMail]/Trash folder(s) for the account. After some pondering, the
following seems to work. I'd be interested in alternate suggestions,
though.
Suppose that I have two gnus imap groups corresponding to gmail
accounts:
nnimap+gmail1
nnimap+gmail2
Use the following to create the per-group "expiry targets".
;----------------------------------------
(setq gm-gmail1-expiry-targets
(list (from ".*" "nnimap+gmail1:[Gmail]/Trash"))
(setq gm-gmail2-expiry-targets
(list (from ".*" "nnimap+gmail2:[Gmail]/Trash"))
(defun gm-gmail1-expiry-target-function (group)
(setq nnmail-fancy-expiry-targets gm-gmail1-expiry-targets)
(nnmail-fancy-expiry-target group))
(defun gm-gmail2-expiry-target-function (group)
(setq nnmail-fancy-expiry-targets gm-gmail2-expiry-targets)
(nnmail-fancy-expiry-target group))
;----------------------------------------
Now use gnus-parameters (or group parameters, or topic parameters)
to connect the expiry functions:
;----------------------------------------
(setq gnus-parameters
'(
("nnimap\\+gmail1.*"
(expiry-target . gm-gmail1-expiry-target-function)
)
("nnimap\\+gmail2.*"
(expiry-target . gm-gmail2-expiry-target-function)
)
))
;----------------------------------------
I guess my feeling is that it might be better (??!) if
nnmail-fancy-expiry-target(s) could also qualify expiry targets based on
the value of group, rather than just based data found in the header of
the article. But this might be unwieldy for reasons I haven't thought
of...and anyhow the above seems to do the job.
* smtp
I wanted to be able to adjust the smtp-user via gnus-posting-styles --
e.g. so that "sent" mail automatically ends up in the
[Gmail]/Sent
folder of the correct gmail account.
One solution is to adapt some code found here
http://emacswiki.org/emacs/MultipleSMTPAccounts
as follows.
;----------------------------------------
(eval-after-load "smtpmail"
'(progn
(defun smtpmail-get-and-delete-smtp-user-from-header ()
"Find header field X-SMTP-User and if found return value as
string and delete header field. If a header field of this
name doesn't exist, return nil."
(save-excursion
(goto-char (point-min))
(save-match-data
(let ((smtp-server))
(loop until (or (eobp) (looking-at "^[ \t]*$"))
if (looking-at "X-SMTP-User[ \t]*:[ \t]*\\(.*?\\)[ \t]*\n")
return (prog1 (match-string 1) (replace-match ""))
else
do (forward-line 1))))))
(defadvice smtpmail-via-smtp (around set-smtp-user-from-header activate)
(let ((smtpmail-smtp-user (or (smtpmail-get-and-delete-smtp-user-from-header)
smtpmail-smtp-user)))
ad-do-it
))))
;----------------------------------------
Now just do something like
(setq gnus-posting-styles
'(
("gmail1"
("X-SMTP-User" "gmail1-user")
)
("gmail2"
("X-SMTP-User" "gmail2-user")
)
)
)
(or add the relevant lines to existing defn of gnus-posting-styles...)
to insert "X-SMTP-User" headers temporarily in the mail for consumption by
smtpmail-via-smtp when sending the mail.
best,
george
--
,--<>----
| George McNinch <gmcninch (at) gmail.com>
| http://gmcninch.math.tufts.edu
`--<>----
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: multiple gmail accounts: smtp and expiry
2012-04-14 17:36 multiple gmail accounts: smtp and expiry George McNinch
@ 2012-04-17 12:43 ` Sivaram Neelakantan
2012-04-17 13:48 ` Richard Riley
0 siblings, 1 reply; 7+ messages in thread
From: Sivaram Neelakantan @ 2012-04-17 12:43 UTC (permalink / raw)
To: info-gnus-english; +Cc: ding
On Sat, Apr 14 2012,George McNinch wrote:
> Hi,
>
> To the extent that this is useful, I thought I'd share some
> idea(s)/solution(s) to issues related to smtp and expiry for multiple
> gmail accounts in gnus.
Nice.
If I may be bold enough to request, why don't you put this up in
emacswiki? All I did for GnusMSMTP link in wiki was simply write down
stuff similar to way you'd done here. It took me 10m to figure things
out on the wiki.
[snipped 113 lines]
And if people have better ideas, they'd correct it on the wiki.
sivaram
--
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: multiple gmail accounts: smtp and expiry
2012-04-17 12:43 ` Sivaram Neelakantan
@ 2012-04-17 13:48 ` Richard Riley
2012-04-18 15:42 ` Sivaram Neelakantan
0 siblings, 1 reply; 7+ messages in thread
From: Richard Riley @ 2012-04-17 13:48 UTC (permalink / raw)
To: info-gnus-english; +Cc: ding
Sivaram Neelakantan <nsivaram.net@gmail.com> writes:
> On Sat, Apr 14 2012,George McNinch wrote:
>
>> Hi,
>>
>> To the extent that this is useful, I thought I'd share some
>> idea(s)/solution(s) to issues related to smtp and expiry for multiple
>> gmail accounts in gnus.
>
> Nice.
>
> If I may be bold enough to request, why don't you put this up in
> emacswiki? All I did for GnusMSMTP link in wiki was simply write down
> stuff similar to way you'd done here. It took me 10m to figure things
> out on the wiki.
>
> [snipped 113 lines]
>
> And if people have better ideas, they'd correct it on the wiki.
>
Except in reality they don't. Mutiple smtp accounts has numerous
solutions - some which do and some which dont work with multiple gmail
accounts and the latest Gnus and for someone not familiar with elisp to
a high level its pretty complicated. Thsi issue has been here for a
while, the fact its raised regularly is proof of the pudding, and I
believe the developers intend to get Gnus working with multiple smtp
accounts from the base gnus using the authinfo files at some
stage. Perhaps already done - I dont know.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: multiple gmail accounts: smtp and expiry
2012-04-17 13:48 ` Richard Riley
@ 2012-04-18 15:42 ` Sivaram Neelakantan
2012-04-18 15:47 ` Richard Riley
0 siblings, 1 reply; 7+ messages in thread
From: Sivaram Neelakantan @ 2012-04-18 15:42 UTC (permalink / raw)
To: info-gnus-english; +Cc: ding
On Tue, Apr 17 2012,Richard Riley wrote:
[snipped 19 lines]
>> And if people have better ideas, they'd correct it on the wiki.
>>
>
> Except in reality they don't. Mutiple smtp accounts has numerous
> solutions - some which do and some which dont work with multiple gmail
> accounts and the latest Gnus and for someone not familiar with elisp to
True. You at least know what didn't work. :-)
[snipped 6 lines]
sivaram
--
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: multiple gmail accounts: smtp and expiry
2012-04-18 15:42 ` Sivaram Neelakantan
@ 2012-04-18 15:47 ` Richard Riley
2012-04-20 16:27 ` Sivaram Neelakantan
2012-11-14 12:06 ` Easior
0 siblings, 2 replies; 7+ messages in thread
From: Richard Riley @ 2012-04-18 15:47 UTC (permalink / raw)
To: info-gnus-english; +Cc: ding
Sivaram Neelakantan <nsivaram.net@gmail.com> writes:
> On Tue, Apr 17 2012,Richard Riley wrote:
>
> [snipped 19 lines]
>
>>> And if people have better ideas, they'd correct it on the wiki.
>>>
>>
>> Except in reality they don't. Mutiple smtp accounts has numerous
>> solutions - some which do and some which dont work with multiple gmail
>> accounts and the latest Gnus and for someone not familiar with elisp to
>
> True. You at least know what didn't work. :-)
In addition the msmtp solution is not nice since (a) its external to
emacs/gnus and (b) passwords are kept in clear text as opposed to the
much more preferablie .authinfo.gpg. Possibly there is some cleaver way
around that but I dont know.
>
> [snipped 6 lines]
>
> sivaram
> --
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: multiple gmail accounts: smtp and expiry
2012-04-18 15:47 ` Richard Riley
@ 2012-04-20 16:27 ` Sivaram Neelakantan
2012-11-14 12:06 ` Easior
1 sibling, 0 replies; 7+ messages in thread
From: Sivaram Neelakantan @ 2012-04-20 16:27 UTC (permalink / raw)
To: info-gnus-english; +Cc: ding
On Wed, Apr 18 2012,Richard Riley wrote:
[snipped 15 lines]
> In addition the msmtp solution is not nice since (a) its external to
> emacs/gnus and (b) passwords are kept in clear text as opposed to the
> much more preferablie .authinfo.gpg. Possibly there is some cleaver way
> around that but I dont know.
Again true! But If I had smtp, gmail accounts and all the knickknacks
working in Emacs, I wouldn't have gone on to looking at msmtp?
[snipped 6 lines]
sivaram
--
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: multiple gmail accounts: smtp and expiry
2012-04-18 15:47 ` Richard Riley
2012-04-20 16:27 ` Sivaram Neelakantan
@ 2012-11-14 12:06 ` Easior
1 sibling, 0 replies; 7+ messages in thread
From: Easior @ 2012-11-14 12:06 UTC (permalink / raw)
To: info-gnus-english
>>>>> "RR" == Richard Riley <rileyrg@gmail.com> writes:
RR> Sivaram Neelakantan <nsivaram.net@gmail.com> writes:
>> On Tue, Apr 17 2012,Richard Riley wrote:
>>
>> [snipped 19 lines]
>>
>>>> And if people have better ideas, they'd correct it on the wiki.
>>>>
>>>
>>> Except in reality they don't. Mutiple smtp accounts has numerous
>>> solutions - some which do and some which dont work with multiple
RR> gmail
>>> accounts and the latest Gnus and for someone not familiar with
RR> elisp to
>>
>> True. You at least know what didn't work. :-)
RR> In addition the msmtp solution is not nice since (a) its external to
RR> emacs/gnus and (b) passwords are kept in clear text as opposed to the
RR> much more preferablie .authinfo.gpg. Possibly there is some cleaver
RR> way
RR> around that but I dont know.
If you want to let gnus work with .authinfo.gpg, you can use
,-------------------------------------------------
|(setq auth-sources '((:source "~/.authinfo.gpg")))
`-------------------------------------------------
It also works with nnimap back end for gmail account. You could try it.
>>
>> [snipped 6 lines]
>>
>> sivaram
>> --
RR> _______________________________________________
RR> info-gnus-english mailing list
RR> info-gnus-english@gnu.org
RR> https://lists.gnu.org/mailman/listinfo/info-gnus-english
--
Best regards,
Easior
-----
Ich bin von heute und ehedam, aber etwas ist in mir, das ist vor
morgen und übermorgen und einstmal.
Friedrich Wilhelm Nietzsche
----------------------------------------------------------------
_______________________________________________
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-11-14 12:06 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-14 17:36 multiple gmail accounts: smtp and expiry George McNinch
2012-04-17 12:43 ` Sivaram Neelakantan
2012-04-17 13:48 ` Richard Riley
2012-04-18 15:42 ` Sivaram Neelakantan
2012-04-18 15:47 ` Richard Riley
2012-04-20 16:27 ` Sivaram Neelakantan
2012-11-14 12:06 ` Easior
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).