php imap附件没有显示,php – imap – 获取附件

如何从此电子邮件中获取附件?

这个电子邮件是从一个苹果电脑发送的,而且电子邮件的结构并不像任何其他的(惊喜).这里配置的部分比其他的更深一些.

该脚本与每个其他电子邮件一起使用,其中文件的部分位于第一个维度,但不与此一个

$part-> dparameters [0] – >值返回文件名,但strlen($data)返回0

imap流

$structure = imap_fetchstructure($this->stream, $this->msgno);

if(isset($structure->parts)){

print_r($structure->parts);

$this->parse_parts($structure->parts);

}

function parse_parts($parts){

foreach($parts as $section => $part){

if(isset($part->parts)){

// some mails have one extra dimension

$this->parse_parts($part->parts);

}

elseif(isset($part->disposition)){

if(in_array(strtolower($part->disposition), array('attachment','inline'))){

$data = imap_fetchbody($this->stream, $this->msgno, $section+1);

echo $part->dparameters[0]->value.' '.strlen($data)."\n";

}

}

}

}

的print_r

Array

(

[0] => stdClass Object

(

[type] => 0

[encoding] => 0

[ifsubtype] => 1

[subtype] => PLAIN

[ifdescription] => 0

[ifid] => 0

[lines] => 15

[bytes] => 173

[ifdisposition] => 0

[ifdparameters] => 0

[ifparameters] => 1

[parameters] => Array

(

[0] => stdClass Object

(

[attribute] => CHARSET

[value] => us-ascii

)

)

)

[1] => stdClass Object

(

[type] => 1

[encoding] => 0

[ifsubtype] => 1

[subtype] => MIXED

[ifdescription] => 0

[ifid] => 0

[bytes] => 23420

[ifdisposition] => 0

[ifdparameters] => 0

[ifparameters] => 1

[parameters] => Array

(

[0] => stdClass Object

(

[attribute] => BOUNDARY

[value] => Apple-Mail=_800896E0-A9C9-456E-B063-79CED9DD4FD7

)

)

[parts] => Array

(

[0] => stdClass Object

(

[type] => 0

[encoding] => 0

[ifsubtype] => 1

[subtype] => HTML

[ifdescription] => 0

[ifid] => 0

[bytes] => 136

[ifdisposition] => 0

[ifdparameters] => 0

[ifparameters] => 1

[parameters] => Array

(

[0] => stdClass Object

(

[attribute] => CHARSET

[value] => us-ascii

)

)

)

[1] => stdClass Object

(

[type] => 3

[encoding] => 3

[ifsubtype] => 1

[subtype] => PDF

[ifdescription] => 0

[ifid] => 0

[bytes] => 17780

[ifdisposition] => 1

[disposition] => INLINE

[ifdparameters] => 1

[dparameters] => Array

(

[0] => stdClass Object

(

[attribute] => FILENAME

[value] => 057 - LPJ - Stik og labels.pdf

)

)

[ifparameters] => 1

[parameters] => Array

(

[0] => stdClass Object

(

[attribute] => NAME

[value] => 057 - LPJ - Stik og labels.pdf

)

)

)

[2] => stdClass Object

(

[type] => 0

[encoding] => 4

[ifsubtype] => 1

[subtype] => HTML

[ifdescription] => 0

[ifid] => 0

[lines] => 75

[bytes] => 4931

[ifdisposition] => 0

[ifdparameters] => 0

[ifparameters] => 1

[parameters] => Array

(

[0] => stdClass Object

(

[attribute] => CHARSET

[value] => us-ascii

)

)

)

)

)

)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值