如何使用 PHP 构建基于 Web 的电子邮件客户端?
我想学习如何用 PHP 构建一个基于网络的电子邮件客户端(类似于 yahoo 和 gmail)。
有谁知道我如何开始使用这个?
我希望我的系统能够发送和接收电子邮件。
I would like to learn how to build a web-based email client in PHP (similar to yahoo and gmail).
Does anyone know how I can get started with this?
I would like my system to be able to send and receive email.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
您可以使用 PHP IMAP 函数轻松构建一个简单的,但如果您必须询问,那么可能会有点麻烦对你来说很复杂。
您是否考虑过使用预建的:
You can build a simple one quite easily using the PHP IMAP functions but if you have to ask then it might be a bit complicated for you.
Have you considered using a pre-built one:
这是一个很大的问题!
您的主要选择是
1. 直接将您的代码与现有邮件服务器集成
2. 使用 IMAP 和 SMTP 与现有邮件服务器通信
第 2 点是最简单的,因为您可以根据需要更改邮件服务器。
是的,还有很多事情需要考虑
Thats a HUGE question!
Your main options are
1. Directly integrating your code with an existing mail server
2. Using IMAP and SMTP to talk to an existing mail server
Number 2 is the most straightforward because you can change mail servers if you ever need to.
and yes there's a lot more to consider as you go
设置可通过 POP 访问的电子邮件帐户(例如:gmail)。 然后使用 PHP IMAP 函数通过 POP 协议检索电子邮件(POP 可能比 IMAP 更容易)(https:// www.php.net/imap)。 要发送邮件,请使用 PHP 邮件函数 (https://www.php.net/mail) 。
Set up an email account that can be accessed via POP (example: gmail). Then use the PHP IMAP functions to retrieve email via the POP protocol (POP is probably easier than IMAP) (https://www.php.net/imap). For sending mail, use the PHP Mail functions (https://www.php.net/mail).
最明显的答案应该是“很棒”。
我同意。 对于目前我们所坚持的所谓最性感的界面,很明显我们需要一些不同的东西。 对于那些认为我喜欢发明轮子的人:我不喜欢! 我刚刚安装了一个新网站,我对结果非常满意。 我基本上使用了 1000 个小时的免费开发人员工作,并且不愿意重新发明以前已经做过的、比以前好 1000 倍的东西。 我会用现在的 10% 来设计一个网站,并且会花费 10 倍的时间。 布局很棒,功能也很棒。 我有身份验证、Facebook 类型的社交网络、供我和我的家人存储文件的私人区域、议程、照片和视频支持、YouTube 集成、Facebook 集成……我会有更多,我会添加游戏等等。所有这些几乎都是免费的(我确实在 facebook 类型的社交网络上花费了大约 100 美元)。 如何:joomla。 开源,大量插件。 成千上万的开发人员、设计师、测试人员等的工作。我自己永远无法做到这一点,我也无法永远支付费用。 但它是免费的,所以我不需要。 顺便说一句:joomla 只是众多开源 cms 之一。
我找不到的是一个合适的基于网络的电子邮件客户端,它是“性感的”,并且可以在 cms 系统中正确集成。 我找到并购买了一个圆形立方体包装纸,以插入我精彩的网站。 但不幸的是,这个看起来很旧的垃圾电子邮件网络客户端是不正确的。 它很慢,交互很愚蠢,你需要购买昂贵的模板才能使其与移动设备兼容。 它只是不适合。它看起来很旧。
Joomla 附带了很多免费的东西、插件、身份验证、地址簿、多语言、模板、移动设备支持,所有您需要的一个合适的网站。 只需要一些努力将它们粘合在一起(无需软件开发)。
现在我将开发一个插件来与我的邮件服务器交互,然后我很快就完成了。
不要重新发明,但也不要沮丧。
Most obvious answer should be "great".
I agree. With the current so-called-most-sexy interface we're stuck with, it's clear we need something different. For those thinking I like to invent the wheel: I don't! I just installed a new website and I am very satisfied with the result. I basically used 1000s of hours of free developers' work and would hate to re-invent something which has been done before, 1000 times better. I would come up with a website 10% of what I would have right now and would have spend 10 times longer. The layout is great, the functionality is great. I have authentication, a face-book type of social network, private area for me and my family to store files, agenda, photo and video support, youtube integration, facebook integration, ... I will have more, I'll add games, etc. All pretty much for free (I did spent about 100 usd on the facebook-type-of-social network). How: joomla. Open source, loads of plugins. 100s of thousands of developer's work, designers work, testers, etc. I would never be able to do this myself, neither would I be able to pay for ever. But it's for free, so I didn't need to. And by the way: joomla is only one of many open source cms.
What I can't find is a proper web-based email client which is "sexy", and which integrates properly within the cms system. I found and bought a roundcube wrapper, to plug in into my wonderful website. But unfortunatly this very-old-looking-crap-email webclient is just not right. It's slow, the interaction is silly, you need to buy expensive templates to make it work with mobile devices. It just does't fit in. It looks old.
Joomla comes with a lot of free stuff, plugins, authentication, address books, multi language, templates, mobile devices support, ALL you need for a proper website. Just needs a bit of effort to glue it all together (no software development).
Now I will work on a plugin to interact with my mail server, then I have this done in no time.
Don't re-invent, but don't get depressed neither.
如果您不使用外部邮件服务(例如 Gmail),您将需要配置自己的服务器来存储和发送电子邮件。 这里是使用 Postfix(用于发送邮件)和 Dovecot(用于通过 IMAP 访问邮件)。
本教程还介绍了在 SquirrelMail 中设置网络邮件系统。 您可以这样做,或者,如果您确实想开发自己的系统,您可以编写一个 PHP 应用程序来访问您的邮件。
祝你好运!
If you're not using an external mail service (like Gmail) you will need to configure your own server to store and send email. Here is a tutorial for using Postfix (for sending mail) and Dovecot (for accessing mail via IMAP).
This tutorial also explains setting up a webmail system in SquirrelMail. You could do this, or, if you really want to develop your own system you could write a PHP application to access your mail.
Good Luck!
不。 已经太多了: http://www.google.ro/search?q=opensource+email+client+php&ie=utf -8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a
Don't. There are already way too many: http://www.google.ro/search?q=opensource+email+client+php&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a
最明显的答案是“不要”:已经有很多网络邮件软件,其中一些是基于 PHP 的(如果您依赖于使用 PHP,因为您已经拥有服务器例如,基于 LAMP 堆栈)。
仅引用几个基于 PHP 的名称,您可以查看这些名称:
我已经使用列表中的三个第一相当一段时间了; roundcube 绝对是最“用户友好”,我想说...
(稍微谷歌一下,你可能会发现更多 - 但我想我谈到了那些最常用的)
现在,如果您必须为您的公司设置一个网络邮件:绝对使用一些现有的软件:
作为旁注:如果你的公司希望你构建 gmail 的克隆,你不会(同样的事情:有多少人在 gmail 上工作?你的公司有多少程序员?你的公司可以在这方面花多少钱?)...
每年只需花费几美元,您的公司就可以为其每位员工拥有一个“专业”Google 帐户,顺便说一句...
毕竟,如果您仍然想/必须使用 LA*(M)*P 堆栈编写自定义的手工 Webmail,您至少需要了解以下内容:
考虑到这一切都不是问题(如果您还不太擅长这一切,和/或没有太多经验,那么可能至少需要几年时间才能获得这些...考虑到编程和 Web 开发是您的全职活动),您可以开始考虑使用 IMAP 等方式访问邮件服务器。
这里有几种可能性。
至少在选择之前,我会看看这两个:
Zend_Mail
; 也许它可以在 Zend Framework 之外使用,顺便说一句,一旦您的应用程序完成,您将(希望如此!)开始获得用户,这至少意味着三件事:
再次,你准备好应对这个问题了吗?
好吧,我想我说得够多了; 现在,您需要思考:您真的想要/需要从头开始开发这样的应用程序吗?
如果您有一点空闲时间,也许您可以参与一个已经存在的开源项目?这对每个人来说都是有利可图的;-)
Finally, one last thing: **if you want to work on such a project just for fun, to know what it's like, and to learn more about web-development, then DO !**
*(It's, in my opinion, probably the only reason that would justify working on this, BTW)*
Most obvious answer would be "don't": there are already lots of webmail software, some of which are PHP-based (if you depend on using PHP, because you already have a server based on a LAMP stack, for instance).
To quote only a few names, all PHP-based, you could have a look at these ones:
I've used the three firsts of the list for quite some time ; roundcube was definitely the most "user-friendly", I'd say...
(Googling a bit, you might find many more -- but I think I spoke about the ones that are the most used)
Now, if you have to set up a Webmail, say, for you company: definitely use some already existing software:
As a sidenote: if your company wants you to build a clone of gmail, you won't (same thing: how many people worked on gmail? How many programmers does your company have? How much can your company spend on this? )...
And for just a couple dollars each year, your company could have a "professionnal" Google account for each one of it's employes, BTW...
After all this, if you still want to / have to write a custom hand-made webmail using a LA*(M)*P stack, you will need to know at least the following:
Considering all this is not a problem (If you are not quite good at all this already, and/or don't have much experience, it could take at least a couple of years to acquire that... Considering programming and web-developping is your full-time activity), you can start tkinking about accessing a mail server using, for instance, IMAP.
There are several possibilities here.
I would have a look, at least, before choosing, at these two:
Zend_Mail
; maybe it can be used outside of the Zend Framework, BTWOnce your application is quite done, you will (hopefully !) start getting users, which means at least three things:
Here, again, are you ready to deal with that?
Well, I think I said enough ; now, it's your time to think: do you really want/need to develop such an application from scratch?
If you have a bit of free time, maybe you could participate in an already existing, open-source, project ? That could be profitable to every one ;-)
Finally, one last thing: **if you want to work on such a project just for fun, to know what it's like, and to learn more about web-development, then DO !**
*(It's, in my opinion, probably the only reason that would justify working on this, BTW)*
如果您通过了分数5、你就会知道如何建造一个。
If you pass point 5, you'll know how to build one.