从收件箱中提取“回复”标题字段 [英] Extract “reply-to” header field from inbox

查看:85
本文介绍了从收件箱中提取“回复”标题字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从outlook电子邮件服务中专门从标题中提取所有回复电子邮件,我尝试了这段代码,但它工作得很慢并且只提取了4000封电子邮件,尽管我的帐户中有超过300000封电子邮件。



我想从我账户中的所有300000个Outlook电子邮件中提取所有回复标题,请您有一些建议吗?



我尝试过:



 $ hostname ='{imap-mail.outlook.com :993 / IMAP / SSL} INBOX'; 
$ username ='我的展望电子邮件';
$ password ='我的密码';

$ inbox = imap_open($ hostname,$ username,$ password)或die('无法连接到Outlook邮箱'.imap_last_error());

$ emails = imap_search($ inbox,'ALL');


if($ email)
{

rsort($ email);
$ n_msgs = imap_num_msg($ inbox);

for($ i = 1; $ i< $ n_msgs; $ i ++)
{
$ header = imap_header($ inbox,$ i);
$ replyto = $ header-> reply_to;
if(is_array($ replyto)|| is_object($ replyto))
{
foreach($ replyto as $ id => $ object){

$ replytoaddress = $ object->邮箱。 @。 $对象 - >宿主;
$ output。=\ n。 $的ReplyToAddress;
}
}
}
}

解决方案

hostname ='{imap- mail.outlook.com:993/imap/ssl}INBOX';


username ='my outlook email';


password ='我的密码;

I want to extract all reply-to emails from headers specially from outlook email service , i tried this code , but it not work very slow and extract just 4000 email although i have more than 300000 email in my account.

I want to extract all reply-to headers from all 300000 outlook emails in my account , please do you have some suggestions ?

What I have tried:

$hostname = '{imap-mail.outlook.com:993/imap/ssl}INBOX';
$username = 'my outlook email';
$password = 'my password';

$inbox = imap_open($hostname,$username,$password) or die('Cannot connect to outlook mailbox ' . imap_last_error());

$emails = imap_search($inbox,'ALL');


if($emails)
{

rsort($emails);
$n_msgs = imap_num_msg($inbox);

for ($i=1; $i<$n_msgs; $i++) 
{
  $header = imap_header($inbox ,$i);
  $replyto = $header->reply_to;
  if (is_array($replyto) || is_object($replyto))
   {
      foreach ($replyto as $id => $object) {

       $replytoaddress = $object->mailbox . "@" . $object->host;
       $output  .="\n". $replytoaddress; 
       }
    }
 }
}

解决方案

hostname = '{imap-mail.outlook.com:993/imap/ssl}INBOX';


username = 'my outlook email';


password = 'my password';


这篇关于从收件箱中提取“回复”标题字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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