Download the PHP package webfiori/mailer without Composer

On this page you can find all versions of the php package webfiori/mailer. 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

WebFiori Mailer

A basic library for sending HTML based emails using PHP.

Supported PHP Versions

Build Status

In This Page:

Usage

Basic Usage

This section describes most basic use case of the library. It shows how to connect to SMTP server, writing a message and sending it to specific address.

Connecting to SMTP Server

Connection information are represented using an instance of the class webfiori\email\SMTPAccount.

Creating Email Message

After having SMTP connection information, an instance of the class webfiori\email\Email can be created. The consructor of the class will accept one parameter which is the connection that will be used to connect to SMTP server.

Setting Email Subject

To set the subject of the message, the method Email::setSubject() can be used as follows:

Adding a Recipient

Writing Some Text

The email messages which are created using the library are HTML based. They utilize the library webfiori\ui to build the virtual DOM.

An HTML elemtnt can be inserted to the body of the message by using the method Email::insert().

Sending The Message

The final step is to send the message. This can be performed using the method Email::send().

All Togather

When we put all the steps as one, we would have the following:

Attachments

Attachements can be added to any email using the method Email::addAttachment(). The method accepts a single parameter. The parameter can be a string which represents the absolute path of the file to be attached or an object of type webfiori\file\File.

Before Send Callback

Suppose that a developer would like to perform a task everytime the method Email::send() is called, and that event must be called before connecting to SMTP server. In such case, the developer can use the method Email::addBeforeSend(). The method accepts two parameters, first one is a function callback and second one is an optional array of parameters to be passed to the callback.

After Send Callback

Suppose that a developer would like to perform a task everytime the method Email::send() is called, and that event must be called after sending the email. In such case, the developer can use the method Email::addAfterSend(). The method accepts two parameters, first one is a function callback and second one is an optional array of parameters to be passed to the callback.

Accessing SMTP Log

One of the features of the library is the logging of SMTP commands that was sent to server. This is useful in case the developer would like to trace the cause of send failure. To access the log events, the method Email::getLog() can be used. The method will return an array that holds sub-assiciative arrays. each associative array will have 3 indices, command, response-code and response-message.

Storing Email

Since the emails which are constructed using the library are HTML based, they can be stored as HTML web pages. This feature is useful in case the developer would like to test a preview of final constructed email.

To store an email as HTML web page, the method Email::storeEmail() can be used as follows:

The call to the method Email::storeEmail() will do the following:

The final output of the given code will be HTML web page that is similar to following image.

image

Setup Testing

When testing the email, we usually intersted on seeing the final look of the email in addition to knowing who are the recepints of the email. The library provides the developer with two options for testing email messages:

The two testing modes are controlled by the method Email::setMode(). The method is used to set the mode at which the email will use when the method Email::send is called.

Storing as Web Pages

In this case, the mode of sending the message should be set to SendMode::TEST_STORE. Additionally, the location at which the message will be stored at must be provided.

Storing as Web Pages

In this case, the mode of sending the message should be set to SendMode::TEST_SEND. Additionally, the addresses of the users who will receive the email must be provided.


All versions of mailer with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0
webfiori/file Version *
webfiori/ui Version *
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 webfiori/mailer contains the following files

Loading the files please wait ....