Download the PHP package byjg/mailwrapper without Composer

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

Mail Wrapper

Build Status Opensource ByJG GitHub source GitHub license GitHub release

A lightweight wrapper for send mail. The interface is tottaly decoupled from the sender. The motivation is create a single interface for sending mail doesn't matter the sender. There are three options available:

How to use

The MailWrapper has your classes totally decoupled in three parts:

Envelope Class

MailWrapper provides a envelope class with all the basic necessary attributes to create an email. As this Envelope class are totally decoupled from the Mailer engine, you can use it also as DTO. See an example below: (do not forget require "vendor/autoload.php")

Sending the email

Once you have created the envelope you can send the email. Basically you have to register in the fabric all mailer you intend to use and then create the mailer:

You can create the mailer directly without the factory:

Sending attachment

Adding attachment as Embed Image

Adding an image as a inline attachment (or Embed) your mail reader will not show as download but you can use it as an local image in your email.

See the example:

The connection url

To create a new sender you have to define a URL like that:

The options are:

Part Description
scheme The email scheme: smtp, ssl, tls, mandrill and ses. Note that mandrill and ses use your own private api
username The username
password The password
smtpserver The SMTP Host
port The SMTP Port

The protocols available are:

Scheme Description URI Pattern Mailer Object
smtp SMTP over insecure connection smtp://username:password@host:25 PHPMailerWrapper
tls SMTP over secure TLS connection tls://username:password@host:587 PHPMailerWrapper
ssl SMTP over secure SSL connection ssl://username:password@host:587 PHPMailerWrapper
sendmail Sending Email using PHP mail() sendmail://localhost SendMailWrapper
mailgun Sending Email using Mailgun API mailgun://YOUR_API_KEY@YOUR_DOMAIN MailgunApiWrapper
ses Sending Email using Amazon AWS API ses://ACCESS_KEY_ID:SECRET_KEY@REGION AmazonSesWrapper
fakesender Do nothing fakesender://anything FakeSenderWrapper

Gmail specifics

From December 2014, Google started imposing an authentication mechanism called XOAUTH2 based on OAuth2 for access to their apps, including Gmail. This change can break both SMTP and IMAP access to gmail, and you may receive authentication failures (often "5.7.14 Please log in via your web browser") from many email clients, including PHPMailer, Apple Mail, Outlook, Thunderbird and others. The error output may include a link to https://support.google.com/mail/bin/answer.py?answer=78754, which gives a list of possible remedies.

There are two main solutions:

Sending through SMTP

You have to enable the option "Allow less secure apps". It does not really make your app significantly less secure. Reportedly, changing this setting may take an hour or more to take effect, so don't expect an immediate fix. You can start changing here

The connection string for sending emails using SMTP through GMAIL is:

Sending Through XOAuth2

This option is currently unsupported.

Further information and documentation on how to set up can be found on this wiki page.

Amazon SES API specifics

The connection url for the AWS SES api is:

The access_key_id and secret_key are created at AWS Control Panel. The region can be us-east-1, etc.

Mailgun API specifics

The connection url for the Mailgun api is:

The YOUR_API_KEY and YOUR_DOMAIN are defined at Mailgun Control Panel.

The Region of the endpoint can be configured by query parameter "region" (example: mailgun://[email protected]?region=eu)

Valid values are: us and eu.

Sendmail Specifics

The connection url for the Sendmail is:

You need to setup in the php.ini the email relay.

Implementing your Own Wrappers

To implement your own wrapper you have to create a class inherited from: ByJG\Mail\Wrapper\BaseWrapper and implement how to send in the method: public function send(Envelope $envelope);

Install

Running Tests

Dependencies


Open source ByJG


All versions of mailwrapper with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1 <8.4
ext-curl Version *
byjg/convert Version ^5.0
byjg/webrequest Version ^5.0
aws/aws-sdk-php Version ~3.20
phpmailer/phpmailer Version >=6.4.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 byjg/mailwrapper contains the following files

Loading the files please wait ....