2017 © Pedro Peláez
 

library lwmail

Light-Weight Mail Library

image

simpraight/lwmail

Light-Weight Mail Library

  • Thursday, March 13, 2014
  • by simpraight
  • Repository
  • 1 Watchers
  • 0 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

lwmail

Light Weight Mail, (*1)

The currently is the beta version., (*2)

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), (*3)

It is made for use in simple and lightweight in a Japanese environment., (*4)

Install

please appended to composer.json., (*5)

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

and run command composer.phar install or composer.phar update, (*6)

Then, it describes the following file., (*7)

<?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, (*8)

The Versions

13/03 2014

dev-master

9999999-dev

Light-Weight Mail Library

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

by Shinya Matsushita

12/03 2014

v0.1

0.1.0.0

Light-Weight Mail Library

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

by Shinya Matsushita