使用IMAP在服务器上阅读邮件? [英] Reading mails on server with IMAP?

查看:559
本文介绍了使用IMAP在服务器上阅读邮件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在设置一个电子邮件代理,其中通知电子邮件发送给他已订阅的用户,但他可以回复电子邮件 notification@site.com 应该包含他的回复。在服务器端,我想能够阅读他的电子邮件并将他的回复添加到数据库中 - 电子邮件存储在通知用户收件箱中,这是非常好的,现在到可以用PHP阅读它。

I'm setting up an email 'proxy-like' where notification emails are sent to the user that he has subscribed to, but he can reply to the email notification@site.com which should contain his reply. On the server-side I want to be able to read his email and add his reply to the database - the email is stored in the notification user inbox which is great, now to be able to read it with PHP.

所以,我一直在寻找解决方案,许多解决方案是IMAP,所以我以为我会试一试我似乎无法确定我的连接我的服务器打开收件箱。我已经调整到不同的端口,但没有一个可以连接。

So, I've been looking around for solutions for this, many solutions were IMAP so I thought I'd give a try but I cannot seem to figure my connection my server to open the inbox. I've adjusted to different ports, but none of them are able to connect.

imap_open("{localhost/imap:143}", "notification", "password");

我收到这样的错误:

Warning: imap_open(): Couldn't open stream {localhost/imap:143} in /var/www/site.com/www/mail.php on line 8
bool(false)

Notice: Unknown: Connection failed to localhost,143: Connection refused (errflg=1) in Unknown on line 0

Notice: Unknown: Connection failed to localhost,143: Connection refused (errflg=1) in Unknown on line 0

Notice: Unknown: Connection failed to localhost,143: Connection refused (errflg=1) in Unknown on line 0

Notice: Unknown: Connection failed to localhost,143: Connection refused (errflg=2) in Unknown on line 0

我不明白,显然这是我第一次尝试这个,但是我在连接中显然做错了?

I don't understand, obviously this is my first time trying this but what is it that I'm clearly doing wrong with the connection?

编辑:我开始 courier-imap 现在我得到这个:

I started courier-imap now I get this:

Notice: Unknown: [CLOSED] IMAP connection broken (server response) (errflg=1) in Unknown on line 0

Notice: Unknown: [ALERT] Fatal error: No such file or directory: No such file or directory in Unknown on line 0


推荐答案

我的Ubuntu 11.04系统有完全相同的问题,通过在我的主目录(如 here )中创建Maildir文件夹,解决了这个问题以下命令:

I had exactly the same problem on my Ubuntu 11.04 system, and I've solved by creating the "Maildir" folders in my home directory (as described here) with the following commands:

cd ~
maildirmake Maildir
maildirmake Maildir/.Drafts
maildirmake Maildir/.Sent
maildirmake Maildir/.Trash
maildirmake Maildir/.Templates
chmod -R 700 Maildir

首先,您应该检查日志文件/ var / log / syslog中的错误(例如通过执行命令 sudo tail / var / log / syslog )。

在我的日志中,我注意到以下错误: imapd:chdir Maildir:没有这样的文件或目录

所以我检查了配置文件/ etc / courier / imapd,我看到MAILDIRPATH选项设置为Maildir:

First of all, you should check for errors in the log file "/var/log/syslog" (for example by executing the command sudo tail /var/log/syslog).
In my log I had noticed the following error: imapd: chdir Maildir: No such file or directory.
So I've checked the configuration file "/etc/courier/imapd" and I saw that the MAILDIRPATH option was set to "Maildir":

#
# MAILDIRPATH - directory name of the maildir directory.
#
MAILDIRPATH=Maildir

然后我创建了Maildir文件夹,如上所述,imap_open()函数终于有效。

Then I've created the "Maildir" folders as described above, and the "imap_open()" function finally worked.

这篇关于使用IMAP在服务器上阅读邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆