定制 haogood/php-imap 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

haogood/php-imap

Composer 安装命令:

composer require haogood/php-imap

包简介

Get email contents and attachments using php imap extension.

README 文档

README

Author Release Software License Size

Requirements

  • PHP >= 5.5.0
  • IMAP PHP Extension

Installation

composer require haogood/php-imap

Initialize

use IMAP\IMAPMailbox;
$host = '{imap.gmail.com:993/imap/ssl}';
$user = 'user@gmail.com';
$pwd = '******';
$mailbox = new IMAPMailbox($host, $user, $pwd);

Search

$emails = $mailbox->search('ALL');

Fetch header info

foreach ($emails as $email) {

    // Header info
    $headerinfo = $email->fetchHeaderinfo();

    // Author
    $author = $headerinfo->from->personal;

    // Sender address
    $from = $headerinfo->from->mailbox.'@'.$headerinfo->from->host;

    // Timestamp
    $timstamp = $headerinfo->udate;

    // Contents
    $contents = $email->getBody();

}

Fetch attachments

foreach ($emails as $email) {
    foreach($email->getAttachments() as $attachment) {

        // Filename
        $filename = $attachment->getFilename();

        // Extension
        $ext = $attachment->getExtension();

        // Attachment file
        $file = $attachment->getBody();

        // Attchment info
        $info = $attachment->getInfo();

    }
}

Reference

License

haogood/php-imap is licensed under The MIT License (MIT).

统计信息

  • 总下载量: 45
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-03-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固