定制 simpraight/lwmail 二次开发

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

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

simpraight/lwmail

Composer 安装命令:

composer require simpraight/lwmail

包简介

Light-Weight Mail Library

README 文档

README

Light Weight Mail

The currently is the beta version.

This library is used to perform the e-mail transmission easily in PHP. Protocol currently supported are as follows.

  • POP3 (+SSL)
  • SMTP (+SSL,TLS and STARTTLS)
  • SMTP-AUTH (PLAIN, LOGIN, CRAM-MD5)

It is made for use in simple and lightweight in a Japanese environment.

Install

please appended to composer.json.

require: {
  "simpraight/lwmail": "*"
}

and run command composer.phar install or composer.phar update

Then, it describes the following file.

<?php
require 'vendor/autoload.php';

Usage

###POP3 Sample code

<?php
use \LWMail\Protocol\POP3;
use \LWMail\MailMessage;

$pop3 = new POP3(array(
    'protocol' => 'ssl',
    'host' => 'smtp.gmail.com',
    'port' => 995,
    'pop3.user' => 'xxxxxxx',
    'pop3.pass' => 'xxxxxxx',
));

$mails = array();
foreach ($pop3->getList() as $msg)
{
    $mails[] = MailMessage::parse($pop3->getRetr($msg['id']));
}

###SMTP Sample code

use \LWMail\Protocol\SMTP;
use \LWMail\MailMessage;

$message = MailMessage::create();
$message->from = 'Myname <me@sample.com>';  // or array('name' => 'Myname', 'mail' => 'me@sample.com');
$message->to = 'Yourname <you@sample,com>';
$message->cc = 'someone1@sample.com';
$message->cc = 'someone2@sample.com';  // Add to CC, not overwrite.
$message->subject = "Mail Subject";
$message->body = "Message \n Body";
$message->attachment = array('filename' => 'test1.pdf', 'path' => '/tmp/test1.pdf', 'mime' => 'application/pdf');
$message->attachment = array('filename' => 'test2.pdf', 'path' => '/tmp/test2.pdf', 'mime' => 'application/pdf'); // Add attachment.

$smtp = new SMTP(array(
    'host' => 'smtp.gmail.com',
    'port' => 587,
    'smtp.auth' => true,
    'smtp.user' => 'xxxxxx',
    'smtp.pass' => 'xxxxxx',
    'smtp.starttls' => true,
));

$smtp->send($message);

License

MIT License

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-03-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固