简体   繁体   English

从同一fetchmail客户端读取多个imap.gmail.com

[英]reading from multiple imap.gmail.com from the same fetchmail client

For my portfolio software I have been using fetchmail to read from a Google email account over IMAP and life has been great. 对于我的投资组合软件,我一直使用fetchmail通过IMAP从Google电子邮件帐户中读取内容,生活非常好。 Thanks to the miracle of idle connection supported by imap3, my triggers fire in near-realtime due to server push, much sooner than periodic polling would allow otherwise. 多亏了imap3支持的空闲连接奇迹,由于服务器推送,我的触发器几乎实时触发,比定期轮询所允许的要快得多。

In my basic .fetchmailrc setup, in which a brokerage customer's account emails trade notifications to a dedicated Gmail/Google Apps box, I've had 在我的基本.fetchmailrc设置中,经纪客户的帐户通过电子邮件将交易通知通过电子邮件发送到专用的Gmail / Google Apps框中,

poll imap.gmail.com proto imap user "youraddress@yourdomain-OR-gmail.com" pass "yoMama"  keep nofetchall ssl  idle mimedecode limit 29000 no rewrite mda "myCustomSpecialMDAhandler.sh  %F %T"

Trouble is, now I need to support reading from multiple email boxes, and hand off the emails to other specialized MDA scripts I wrote. 麻烦的是,现在我需要支持从多个电子邮件框中读取内容,并将电子邮件移交给我编写的其他专用MDA脚本。 No problem, just add more poll lines to .fetchmailrc , right? 没问题,只需向.fetchmailrc添加更多轮询行,对吗? Well that doesn't work when the other accounts also use imap.gmail.com . 嗯,当其他帐户也使用imap.gmail.com时,这是行不通的。 What ends up happening is that while one account reads fine (and not necessary the first one listed, though usually yes), the other is getting "socket error" all day and the emails remain untouched, unread. 最终发生的事情是,尽管一个帐户可以正常读取(并且不一定要列出第一个帐户,尽管通常是这样),但另一个帐户整天都收到“套接字错误” ,并且电子邮件保持不变,未被读取。 I can't figure out why and not even sure if it's some mechanism at imap.gmail.com or not, eg. 我不知道为什么,甚至不确定在imap.gmail.com是否有某种机制,例如。 limiting to one IMAP connection from a host. 仅限来自主机的一个IMAP连接。 That doesn't seem right since I have kept IMAP connections to many separate Gmail & Google Apps accounts from the same client for years (like Thunderbird ) and never noticed this exclusivity problem. 这似乎是不对的,因为多年来我一直将IMAP连接到来自同一客户端的许多单独的Gmail和Google Apps帐户(例如Thunderbird ),并且从未注意到这一排他性问题。

I haven't tried launching multiple fetchmail daemons using separate -f config files (assuming they wouldn't conflict), or deploying one or more getmail and other similar email fetchers in addition. 我没有尝试使用单独的-f配置文件启动多个fetchmail守护程序(假设它们不会冲突),或者还部署了一个或多个getmail和其他类似的电子邮件提取程序。 Still trying to avoid that kind of mess--unscaleable the more boxes I have to monitor. 仍在努力避免这种混乱-我必须监视的更多盒子无法缩放。

Don't have the reference offhand but somewhere in fetchmail 's docs I recall reading that idle is not so much an imap feature as a fetchmail optional trick, which has a (nasty for me) side effect of choking off all other defined accounts from polling until the connection is cut off by some external event or timeout. 没有即时可用的参考,但我记得在fetchmail的文档中的某处,我读到的内容是, 闲置不是fmapmail可选技巧的imap功能,它具有(讨厌我)从其他所有已定义帐户中删除的副作用轮询直到由于某些外部事件或超时而断开连接。 So at least that would vindicate Google. 因此,至少这将为Google辩护。

Credit to Carl's Whine Rack blog for some tips. 感谢Carl的Whine Rack博客提供的一些提示。

For now I use killall fetchmail; fetchmail -f fetcher.$[$RANDOM % $numaccounts].rc 现在,我使用killall fetchmail; fetchmail -f fetcher.$[$RANDOM % $numaccounts].rc killall fetchmail; fetchmail -f fetcher.$[$RANDOM % $numaccounts].rc periodically from crontab to cycle reading accounts each defined individually in fetcher.1.rc , fetcher.2.rc , etc. Acceptable while email events are relatively infrequent. killall fetchmail; fetchmail -f fetcher.$[$RANDOM % $numaccounts].rc定期从crontab循环读取每个分别在fetcher.1.rcfetcher.2.rc等中定义的帐户。在电子邮件事件相对少见的情况下可以接受。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM