Library to send e-mails over different transports and protocols (like SMTP and IMAP) using immutable messages and streams. Also includes SMTP server.
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.
$message = (new MessageBodyCollection('
Hello World')) ->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:[email protected]/')->newClient(), EnvelopeFactory::useExtractedHeader() );
$ composer require genkgo/mail
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.
This library tends to be as compliant with e-mail RFCs as possible. It should be compliant with the following RFCs.