Coder Social home page Coder Social logo

mail's Introduction

Genkgo/Mail - Modern PHP 7.1+ Mail Library

Latest Version Build Status Scrutinizer Code Quality Code Coverage

While analyzing what mail library to use when refactoring a code base, we discovered that the available ones are mostly legacy libraries. Some do not use namespaces and every library we encountered was merely a collection of scalar property bags than objects using encapsulation. Although we used these libs with joy in the past, they do not meet current quality standards. So, we built a new and better library according to modern programming principles.

Use this if you want to send e-mails over different transports and protocols using immutable messages and streams.

Send message quick and easy

$message = (new FormattedMessageFactory())
    ->withHtml('<html><body><p>Hello World</p></body></html>')
    ->withAttachment(new FileAttachment('/order1.pdf', new ContentType('application/pdf')))
    ->createMessage()
    ->withHeader(new Subject('Hello World'))
    ->withHeader(From::fromEmailAddress('[email protected]'))
    ->withHeader(To::fromSingleRecipient('[email protected]', 'name'))
    ->withHeader(Cc::fromSingleRecipient('[email protected]', 'name'));

$transport = new SmtpTransport(
    ClientFactory::fromString('smtp://user:pass@host/')->newClient(),
    EnvelopeFactory::useExtractedHeader()
);

$transport->send($message);

Install using composer

$ composer require genkgo/mail

Features

  • Use SMTP or mail() to send messages
  • Queue messages when transport fails
  • Automatically connects and reconnects after interval to SMTP server
  • Automatically generate alternative text for formatted messages
  • Optimal encoded headers, so no excessive (Q/B) encoded headers
  • Optimal encoded multipart messages
  • Only streams and connections are mutable
  • Messages and actors are immutable
  • Value objects protect against invalid states
  • Streams make sure the library has a low memory burden
  • Many objects but still easy API
  • 90%+ test coverage
  • Only uses TLS < 1.2 if not otherwise possible
  • Discourages SSL
  • DKIM signed message
  • Security is high prioritized
  • Great RFC compliance
  • Cast messages to valid string source
  • Library has no external dependencies (but uses intl extension)
  • Only PHP 7.1 and up

Upcoming features

  • Encrypted and signed messages

Documentation

RFC-compliance

This library tends to be as compliant with e-mail RFCs as possible. It should be compliant with the following RFCs.

Credits

This library was not able to exist without Zend/Mail and PHPMailer.

mail's People

Contributors

frederikbosch avatar jakejohns avatar mpyw avatar emielbruijntjes avatar meirbon avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.