【问题标题】:imap gmail fetch message macosximap gmail 获取消息 macosx
【发布时间】:2011-03-03 04:44:22
【问题描述】:

计划使用 php imap 函数,我正在尝试从本地主机测试 imap 协议, 我没有找到 telnet-ssl for mac 但我可以使用 openssl 和 连接起来。

问题是我只能登录但不能选择邮箱, 创建邮箱,获取列表,... 我可以运行的唯一命令是功能,它并没有真正有用。

这是我输入的命令 (#) 和得到的答案 (*)

# openssl s_client -connect imap.gmail.com:993

* CONNECTED(00000003)
* […]
* OK Gimap ready for requests from 77.xxx.xxx.xxx v7if3901328vdd.33

# a001 login myUserName myPassword

* OK myUserName firstname lastname authenticated (Success)



# a002 create testbox

* (nothing, I have to start a new session)

OR

# a002 list "*"
* (nothing, I have to start a new session)

OR

…

不知道问题出在哪里,

是否有人能够成功获取一些邮件 来自 gmail(或其他)在 mac 上使用 imap 吗? (我在 osX10.6 上)

【问题讨论】:

  • fetchmail 很适合这个...

标签: php imap gmail-imap


【解决方案1】:

我认为这可能是一个行尾问题。 Use the -crlf switch and it should work:

-crlf

    this option translated a line feed from the terminal into CR+LF as required
    by some servers.

This is the command I've always used to test Gmail IMAP,它对我来说在 Mac 上运行良好:

openssl s_client -crlf -connect imap.gmail.com:993

另外,您的LIST 命令语法错误。您需要两个参数,而不是一个:

a002 list "" "*"

【讨论】:

  • 是的,做到了!非常感谢,只是因为这只是在手册页上(一如既往)而感到羞愧,我不知道为什么我忽略了它。
  • @ling:如果这回答了您的问题,请在答案左侧click on the checkmark outline。它使下一个遇到相同问题的人清楚地解决了...
【解决方案2】:

使用fetchmail 和procmail 构建本地邮箱。创建 ~/.fetchmailrc 包含...

set postmaster your_local_username
set syslog
set daemon 10
set logfile fetchmail.log

poll "imap.gmail.com" proto imap port 993
    user "gmailaddress@gmail.com" password "password"
    is your_local_username here keep ssl

然后设置procmail 来存储消息...

在您的 ~ 文件夹中,创建 .procmailrc 包含...

SHELL=/bin/bash
DEFAULT=$HOME/.mail/Maildir/ 
MAILDIR=$HOME/.mail/Maildir/
LOCKFILE=$HOME/.mail/.lock
LOGFILE=$HOME/.procmail/log

你可能也需要制作这些文件夹,我忘了。

要开始使用 procmail 获取邮件,请执行以下操作:

fetchmail -kFm "/usr/bin/procmail -d %T"

您可以使用mutt 之类的东西来阅读邮件,就我个人而言,我不会手动阅读正在使用 fetchmail 的邮件,我会将其用于电子邮件自动化,这基本上是 procmail 擅长的您可以创建“配方”来过滤、处理和重定向消息。

维基百科有一个合理的起点learning more about procmail。 man fetchmail 和 man procmail 页面也有很多有用的信息。

【讨论】:

  • 感谢您指出其他解决方案,我打算使用php imap函数来获取消息,因为有php imap函数和教程。现在我不知道 fetchmail,也没有找到 php 的 fetchmail 函数,但现在我知道这是可能的;)我还是想先解决我的“imap gmail 配置”问题。
  • 哦,没关系,我已将 PHP 添加到您的标签中。但是您的问题实际上根本没有提到 PHP,只是关于如何在 Mac Os X 上执行此操作。因此,您可能需要改写您的问题以获得您想要的答案。顺便说一句,fetchmail 和 gmail 有很多资源。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2010-09-18
  • 2015-01-26
  • 2011-04-04
  • 1970-01-01
  • 2012-01-04
  • 2016-03-18
相关资源
最近更新 更多