Download the PHP package originphp/email without Composer

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

Email

license build coverage

The Email class enables you to send emails easily through SMTP.

Installation

To install from the command line type

Email Configuration

In your bootstrap or application config. If you create a default account, then you do not need to specify an account or configure the instance of the email.

The keys for the config are as follows:

You can also pass an array with configuration when you create an instance of the Email object.

You can also pass keys such as from,to,cc,bcc,sender and replyTo this pass the data to its functions either as string if its just an email or an array if you want to include a name. Remember if you are going to automatically cc or bcc somewhere, then you have to next call addBcc or addCc to ensure that you don't overwrite this.

For example

Sending Emails

The default email sending behavior is to send a text version. However it best practice to send both HTML and text and this reduces the risk of your email ending up in spam folders.

When an email is sent it will return a Message object, if an error is encountered when sending then the email class will throw an exception which you can catch in try/catch block.

Sending an Email (Text)

To send an email

Send both a HTML and Text Version (Recommend)

To send an email with both HTML and text versions:

Sending HTML Only Email

To send a HTML only email, you need to tell the Email utility use the HTML format.

Adding Attachments

To add attachments to an email message

Using Multiple Accounts

If you have configured using Email::config('gmail',$config) then you can use it like this

Or

Oauth2

To configure your email account to use Oauth2 authentication, instead of providing a password you can use a token.

Generating Tokens

To generate Oauth2 tokens, you can use the thephpleague/oauth2-client package or if you are using Google (Gsuite/Gmail) then you can use the command line script provided. The script provided is only ideal for sending emails from your own account, rather than from a user account.

Google Command-Line OAuth Token Generator

The Google Client Library API allows you to generate tokens from the command line (without having to redirect to a script), and I have included a quick script for this.

To obtain an Oauth2 token that you can use with your Gsuite/Gmail account follow these instructions.

  1. Enable the Gsuite API for your email account by going to https://developers.google.com/gmail/api/quickstart/php and then click on Enable the Gmail API button, click on Desktop App then the Download Client Configuration button. Once you have done this, save the data file to data/credentials.json in the vendor/originphp/email/ folder.

  2. Install Google Client Library (PHP), by running the following command:

  3. Run the Google CLI script.

Now copy the URL into your browser and follow the instructions on screen, and this will provide you with a code. Paste the code into your console window, and your token will be displayed on the screen. The token JSON will be saved to data/token.json for future reference.

  1. Add the token that was generated to your email configuration.

All versions of email with dependencies

PHP Build Version
Package Version
Requires php Version >=7.3.0
ext-mbstring Version *
originphp/defer Version ^3.0
originphp/configurable Version ^2.0
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 originphp/email contains the following files

Loading the files please wait ....