Open local mbox mail archive with imap_open() in PHP

邮差的信 提交于 2019-12-11 19:30:41

问题


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?


回答1:


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')


来源:https://stackoverflow.com/questions/6779217/open-local-mbox-mail-archive-with-imap-open-in-php

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!