在 CakePHP 中接收/检索电子邮件

发布于 2024-11-15 01:21:30 字数 942 浏览 2 评论 0 原文

我正在为一个小型培训中心开发一个基本但高度定制的 CRM,它能够存储学生记录并向他们发送电子邮件。我正在使用 SwiftMailer,如下 这是在 CakePHP 中完成发送部分的优秀教程。

当然,学生有时会回复电子邮件,我想在 CRM 中检索它们并将其与学生记录一起存储。

但是,我找不到执行此操作的任何参考。我尝试过以下 Google 搜索:“接收电子邮件 cakephp”、“检索电子邮件 cakephp”甚至“电子邮件客户端 cakephp”,但所有这些查询都给出与发送邮件相关的结果,而不是收到它——非常令人沮丧!

最后,我将搜索范围扩大到非蛋糕解决方案,并发现有人推荐了一个名为 ezComponents 的库。它似乎没有任何积极的开发大约一年了,但它包括一个电子邮件接收类,这正是我想要的。不幸的是,我不知道如何将其添加到 CakePHP 和唯一的 帖子我在整个网络上找到了关于此事的详细信息。这当然不是像我上面提到的 SwiftMailer 教程那样在 CakePHP 上使用 ezComponents 的分步教程。

我还在 Google Code 上发现了一个名为 php-imap 的类,看起来它可以完成这项工作,但是,我再次不知道如何让它像 SwiftMailer 一样在 Cake 中愉快地工作。

我意识到我可能必须自己学习如何打包在 Cake 中使用的类,但我首先问这个问题是因为我还没有意识到已经有一个适合 Cake 的解决方案来解决这个问题:-)

约瑟夫

I am developing a basic yet highly customized CRM for a small training centre which has the ability to store student records and also send emails to them. I'm using SwiftMailer following this excellent tutorial in CakePHP to accomplish the sending part.

Of course, students are sometimes going to reply to emails and I'd like to retrieve them within my CRM and store them along with the student record.

However, I cannot find a single reference to doing this. I've tried the following Google searches: "receiving email cakephp" , "retrieving email cakephp" and even "email client cakephp" but all of these queries give results relating to sending mail rather than receiving it -- very frustrating!

Finally, I broadened my search to non-cake solutions and found someone recommending a library called ezComponents. It doesn't seem to have had any active development for about a year, but it includes an email receiving class which is exactly what I want. Unfortunately, I have no idea how to add this to CakePHP and the only post I've been able to find on the entire web on the matter doesn't exactly go into much detail. It's certainly not a step-by-step tutorial on using ezComponents on CakePHP like the SwiftMailer tutorial I mentioned above.

I also found a class on Google Code called php-imap which looks like it would do the job but, again, I haven't the slightest clue how to get it working happily in Cake like SwiftMailer is.

I realize that I may have to learn how to package classes for use in Cake by myself but I'm asking this question first on the off-chance that there is already a Cake-friendly solution to this problem that I just haven't realized :-)

Joseph

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

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

发布评论

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

评论(3

自由如风 2024-11-22 01:21:30

感谢大家的回答,但我做了更多搜索,看起来解决方案实际上非常简单。

基本上,在插件的帮助下,我可以在databases.php中将邮件服务器设置为数据源,然后编写模型和控制器与之交互。

这是我找到的示例: https://github.com/kvz/cakephp-emails-插件

编辑:该存储库已被弃用,现在可以在 https://github.com/kvz/deprecated/tree/cakephp-emails-plugin

Thanks to everyone for your answers, but I've been doing some more searching and it looks like the solution is actually incredibly simple.

Basically, with the help of a plugin, I can set up the mail server in databases.php as a datasource and then write a Model and Controller to interact with it.

Here's the example I found: https://github.com/kvz/cakephp-emails-plugin

Edit: the repo has been deprecated and is now available at https://github.com/kvz/deprecated/tree/cakephp-emails-plugin

烂柯人 2024-11-22 01:21:30

您需要将电子邮件通过管道传输到 PHP 并使用 stdin:// 读取电子邮件的内容并将电子邮件添加到数据库中。

我已经用 cake 完成了此操作,最简单的方法是创建一个 Cake 控制台应用程序来处理解析。使用 cpanel 的帐户级别过滤来生成管道也非常简单。

http://forums.cpanel.net/f5 /piping-mail-php-scripts-howto-checklist-50985.html

http://www.evolt.org/incoming_mail_and_php

You will want to pipe your email to PHP and use stdin:// to read the contents of the email and add the e-mail to your database.

I've done this with cake and the simplest way is to make a Cake console application to handle the parsing. Also using cpanel's account level filtering to generate the pipe is really simple.

http://forums.cpanel.net/f5/piping-mail-php-scripts-howto-checklist-50985.html

http://www.evolt.org/incoming_mail_and_php

墨小墨 2024-11-22 01:21:30

听起来您想将 SwiftMailer 作为 Cake 插件包含在内,amirite?

http://book.cakephp.org/view/1111/Plugins

-- 如果您想自己打包。否则,对面包店的粗略搜索会产生以下结果:

http://bakery.cakephp.org/articles/sky_l3ppard/2009/11/07/updated-swiftmailer-4-xx-component-with-attachments-and-plugins

希望它会至少让你指明正确的方向。 HTH。 :)

Sounds like you want to include SwiftMailer as a Cake plugin, amirite?

http://book.cakephp.org/view/1111/Plugins

-- if you want to package it yourself. Otherwise, a cursory search of the Bakery yielded this result:

http://bakery.cakephp.org/articles/sky_l3ppard/2009/11/07/updated-swiftmailer-4-xx-component-with-attachments-and-plugins

Hopefully it will at least get you pointed in the right direction. HTH. :)

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