在PHP中使用imap_open()打开本地mbox邮件存档 [英] Open local mbox mail archive with imap_open() in PHP

查看:176
本文介绍了在PHP中使用imap_open()打开本地mbox邮件存档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图通过文件访问本地读取从另一个服务器导出的mbox电子邮件归档,但无论如何,我尝试的一切都失败了。解析本地文件并使用PHP的内置IMAP功能访问它有一些神奇的窍门吗?

解决方案

您应该能够使用PHP的内置IMAP功能。你有没有尝试这样的东西:

  function openLocal($ file_path){
$ mbox = imap_open($ file_path , '', '');
if(!mbox){
$ errorMsg = imap_last_error(); //做错事的事情...
return false;
} else {
return true;
}
}

并使用相应的正确路径调用: p>

  openLocal('/ home / email / temp / mailbox')


I'm attempting to read an mbox email archive exported from another server locally, via file access, but for whatever reason everything I've tried fails. Is there some magical trick to parse a local file and access it with PHP's built-in IMAP functionality?

解决方案

You should be able to use PHP's built-in IMAP functionality. Have you tried something like this:

function openLocal($file_path) {     
    $mbox = imap_open("$file_path",'','');
   if (!mbox) {
      $errorMsg = imap_last_error(); // do something with the error...
     return false;
   } else {
      return true;
   }
}

And call this with the respective correct path:

openLocal('/home/email/temp/mailbox')

这篇关于在PHP中使用imap_open()打开本地mbox邮件存档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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