• Stars
    star
    401
  • Rank 107,625 (Top 3 %)
  • Language
    PHP
  • License
    Other
  • Created over 7 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Library to send e-mails over different transports and protocols (like SMTP and IMAP) using immutable messages and streams. Also includes SMTP server.

Genkgo/Mail - Modern PHP Mail Library

Latest Version workflow code check

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

use Genkgo\Mail;

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

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

$transport->send($message);

Install using composer

$ composer require genkgo/mail

Features

  • Use SMTP or mail() to send messages
  • Use IMAPv4 to read messages from your mailbox (no extension required)
  • Create replies and forward messages, including quoting of original message
  • 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
  • Uses highest PHPStan detection level
  • Only uses TLS < 1.2 if not otherwise possible
  • Discourages SSL
  • DKIM signed message
  • Security is highly prioritized
  • SMTP server for testing purposes
  • Great RFC compliance
  • Cast messages to valid string source
  • Library has no external dependencies (but uses intl extension)
  • Only supports PHP versions that are not EOL

Upcoming features

  • Encrypted and signed messages

Not planned

The following features are not planned for development by the owners, but could become part of the library when initiative is taken by the community.

  • POP Support
  • Mailbox abstraction layer

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.

More Repositories

1

ember-localforage-adapter

Offline usage for Ember Data, based on localstorage adapter, but now uses Mozilla's localforage as data source
JavaScript
133
star
2

camt

PHP Parser for CAMT messages
PHP
81
star
3

xsl

XSL 2.0 Transpiler in PHP
PHP
50
star
4

push

Send push messages to Android and Apple using one interface
PHP
12
star
5

migrations

Framework independent migration library for your PHP project
PHP
7
star
6

gworkerd

CLI Worker written in Rust Lang + UI written in Ember
Rust
5
star
7

ap-npm

Private Authenticated NPM Repository
JavaScript
5
star
8

php-ext-fs-notify

PHP Extension for cross-platform filesystem notifications
Rust
4
star
9

api

Genkgo API
PHP
4
star
10

uncompass

Compass mixin removal script
Shell
4
star
11

APNS-iOS-server-token-creator

Simple bash script that automates the steps taken to create, test and prepare the signed server certificate for the Apple Push Notification Service.
Shell
3
star
12

babel-plugin-dynamic-import-amd

Babel plugin to transpile import() to require, for AMD module loaders
JavaScript
2
star
13

favicon

Favicon generator in PHP
PHP
2
star
14

omnipay-abn-internetkassa-ideal-only

Ogone gateway for omnipay
PHP
2
star
15

cache

PHP Cache library using mechanisms as originally proposed by Anthony Ferrara.
PHP
1
star
16

dtk-cli

Genkgo Design Toolkit CLI
JavaScript
1
star
17

routed-enhancement

Progressively enhance webpages by using a router based on CSS selectors, page size, scroll bar position and events
JavaScript
1
star
18

omnipay-ideallite

Omnipay implementation for easy / basic / lite iDeal payments
PHP
1
star
19

broccoli-sass-simultaneous

Simultaneous sass compiler for Broccoli, using broccoli-sass-source-maps
JavaScript
1
star
20

php-asn1

PHP
1
star