Download the PHP package fei/mailer-client without Composer

On this page you can find all versions of the php package fei/mailer-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package mailer-client

Mailer client

GitHub licensecontinuousphpGitHub issues

This is the client you should use to send email to Mail Api.

The client can use two kind of transports to send emails:

BeanstalkProxyTransport delegate the API consumption to workers by sending email properties to a Beanstalkd queue.

BasicTransport use the classic HTTP layer to send emails.

If asynchronous transport is set, it will act as default transport. Synchronous transport will be a fallback in case when asynchronous transport fails.

Installation

Add this requirement to your composer.json: "fei/mailer-client": : "^1.0.0"

Or execute composer.phar require fei/mailer-client in your terminal.

Quick start

Let's start with a simple client :

Keep in mind that you should always initialize a mailer client by a dependency injection component, since it requires at least one dependency, which is the transport. Moreover, the OPTION_BASEURL parameter should also depends on environment.

Real world example

Below a more robust example which use the BeanstalkProxyTransport as default transport.

To work properly, BeanstalkProxyTransport needs a instance of a Beanstalkd server able to listen to its requests. Workers will consume Beanstalkd messages tube (or queue) and will send email data to Mail API server.

The message workflow:

Use the logger

Mailer client is Logger client aware. You could set a logger instance like this example below in order to activate logging functionality.

As is each mail sent will be recorded with logger service.

Email and attachments

Here a example if you need to send email with attachments :

Embedding attachment

Sometime, you need to include image (or other media) inline in your message. You could use a resource URL in order to linking the media but this approach is usually blocked by mail clients. A another approach is to embed your media directly into your message.

And that's it.

Catch them all

In non production environment, you often don't need to send email to the real recipient. For testing purpose, you could initialize the client with the option OPTION_CATCHALL_ADDRESS and all email will be forwarded to email address passed to this option.

Add callback functions before Mail instance validation

For different needs, you could registered a callback to apply on Mail to be send before its state validation.

You can see this as a another way to extends the "mailer-client" functionalities.

With this example, all Mail send with this client will have theirs recipients changed by [email protected].

We provide a couple of another method to manage callbacks:

Pricer integration: meet the PricerMailer class

We provide a child class of Mailer for the Pricer need: PricerMailer.

PricerMailer extends functionalities Mailer plus a callback which apply email filtering on the Mail instance to be send. Naturally, you can remove this filter or add yours own.

Client option

Only one option is available which can be passed to the __construct() or setOptions() methods:

Option Description Type Possible Values Default
OPTION_BASEURL This is the server to which send the requests. string Any URL, including protocol but excluding path -
OPTION_CATCHALL_ADDRESS Recipient to substitute to any other. When used, original recipients, ccs, bccs are prepended to mail body. string Any valid email address -
OPTION_HEADER_AUTHORIZATION Api Key for authentification string Any string value ''

All versions of mailer-client with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0
fei/mailer-common Version ^1.0.18
fei/api-client Version ^1.2.7
fei/logger-client Version ^1.2.11
zendframework/zend-json Version ^2.4.9
egulias/email-validator Version ^2.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package fei/mailer-client contains the following files

Loading the files please wait ....