imap gmail 获取消息 macosx

发布于 2024-10-19 15:59:46 字数 685 浏览 7 评论 0原文

计划使用 php imap 函数,我正在尝试从本地主机测试 imap 协议, 我没有找到适用于 mac 的 telnet-ssl 但我可以使用 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

…

不确定问题出在哪里,

是否有人能够成功获取一些邮件 在 Mac 上使用 imap 从 gmail(或其他)发送邮件? (我在osX10.6上)

planning to use php imap functions, I'm trying to test the imap protocol from my local host,
I didn't found telnet-ssl for mac but I can use openssl and
get connected.

The problem is I can only login but I cannot select a mailbox,
create a mailbox, get a list, …
The only command I can run is capability which is not really useful.

Here is the command I typed (#) and answers I get (*)

# 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

…

Not sure where the problem is,

Was someone able to fetch some mails successfully
from gmail (or other) using imap on mac ?
(I'm on osX10.6)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梨涡少年 2024-10-26 15:59:46

我认为这可能是一个行结束问题。 使用 -crlf 开关,它应该 work

-crlf

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

这是我一直用来测试 Gmail IMAP 的命令,并且它在 Mac 上对我来说工作得很好:

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

此外,您的 LIST 命令的语法很糟糕。您需要两个参数,而不是一个:

a002 list "" "*"

I think this may be a line-ending issue. 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, and it's worked fine for me from a Mac:

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

Also, your LIST command has bad syntax. You need two parameters, not one:

a002 list "" "*"
開玄 2024-10-26 15:59:46

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

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

poll "imap.gmail.com" proto imap port 993
    user "[email protected]" 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 所擅长的,本质上你可以创建“食谱”来过滤、处理和重定向邮件。

维基百科为了解有关 procmail 的更多信息提供了一个合理的起点。 man fetchmailman procmail 页面也有很多有用的信息。

Use fetchmail and procmail to build a local mailbox. Create ~/.fetchmailrc containing...

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

poll "imap.gmail.com" proto imap port 993
    user "[email protected]" password "password"
    is your_local_username here keep ssl

Then setup procmail to store the messages...

In your ~ folder, create .procmailrc containing...

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

You may need to make these folders too, I forget.

To begin fetch mail with procmail do:

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

You can use something like mutt to read the mail, personally I don't read mail manually that I'm doing a fetchmail with, I would use it for email automation, which is what procmail is good at, essentially you can create 'recipes' to filter, process and redirect messages.

Wikipedia has a reasonable starting point for learning more about procmail. The man fetchmail and man procmail pages also have a lot of useful info.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文