Download the PHP package popphp/pop-mail without Composer

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

pop-mail

Build Status Coverage Status

Join the chat at https://popphp.slack.com Join the chat at https://discord.gg/TZjgT74U7E

Overview

pop-mail is the main mail component for the Pop PHP Framework. It provides a robust set of features to manage the many aspects of sending and receiving mail over the internet. It provides functionality for the following:

* - NOTE: The main use-case for this component is that of a server-to-server application connection. This means that the component would be used with an application that has been granted the appropriate access and permissions to act on behalf of the user or users whose emails are being managed by the application. This component is not geared towards an individual user mail application use-case. Please refer to the online documentation, guidelines and polices for whichever mail platforms to which you are attempting to connect your application using this component. Please take care in granting access and assigning permissions to your application instance. Always follow the recommended security policies and guidelines of your chosen mail platform.

pop-mail is a component of the Pop PHP Framework.

Install

Install pop-mail using Composer.

composer require popphp/pop-mail

Or, require it in your composer.json file

"require": {
    "popphp/pop-mail" : "^4.0.0"
}

Top

Quickstart

Example 1: Sending a message via the Mailgun API

Example 2: Sending a message via an SMTP connection

Top

Messages

Message objects can be created and passed to a mailer object to be sent by an application.

Create a simple text mail message:

Create a mail message with both text and HTML parts:

Create a mail message with a file attachment:

Create a mail message with a file attachment from a stream of file contents:

Top

Mailer

Once a message object is created, it can be passed to a mailer object to be sent. The mailer object will require a transport object to perform the required tasks to send the message through the provided mail platform.

Top

Transports

The available transports all share the same interface and are interchangeable. However, they each require different configuration that adheres to the specifications of their mail platform.

Mailgun

The Mailgun transport requires an api_url and api_key. The API key is obtained from the Mailgun administration portal. The Mailgun API URL is typically a string comprised of your approved mail domain, for example:

Top

Sendgrid

The Sendgrid transport requires an api_url and api_key. These values are obtained from the Sendgrid administration portal.

Top

Office 365

The Office 365 transport requires a few more configuration options that are obtained for the approved application from within the Office 365 administration portal. You will need the following:

You can create an Office 365 transport object and then request and store the required token for future requests:

When calling the Office 365 transport object at a later time, you can reuse the token (if it hasn't expired):

If the token has expired, the transport object will automatically refresh it. At this point, you can fetch the new token and its expiration from the transport object and store them.

Top

AWS SES

The AWS SES transport requires a key and secret that are obtained from the AWS SES admin console.

Top

Google

The Google transport requires a number of configuration steps to be performed in the Google administration portal and cloud console. This includes setting up the approved application as a service account and its necessary requirements. When that is complete, you should be prompted to download a JSON file with the appropriate credentials and data for your application:

You can pass the JSON file directly into Google transport object, along with the user email being used. From there, you can request and store the required token for future requests:

When calling the Google transport object at a later time, you can reuse the token (if it hasn't expired):

If the token has expired, the transport object will automatically refresh it. At this point, you can fetch the new token and its expiration from the transport object and store them.

Top

SMTP

The SMTP transport requires the standard configuration parameters for a typical SMTP connection:

Sendmail

Sendmail is the most basic transport. It is not used very often and is not recommended, but could be utilized within testing and dev environments. It leverages the sendmail application running on the server, so it is required that it be set up and configured properly on the server and within PHP for use with PHP's mail function. If needed, you can pass a string of $params into the constructor that will be passed on to the mail function call.

Top

Clients

The available mail clients can be used for monitoring mailboxes and their message content from within an application.

Office 365 Client

Like the Office 365 transport, the Office 365 clients requires a few configuration options that are obtained for the approved application from within the Office 365 administration portal. You will need the following:

You can create an Office 365 client object and then request and store the required token for future requests:

When calling the Office 365 client object at a later time, you can reuse the token (if it hasn't expired):

If the token has expired, the client object will automatically refresh it. At this point, you can fetch the new token and its expiration from the client object and store them.

From there you can interact with the client to fetch messages and their content.

Get messages

Search for unread messages only, limit 5:

Get a message

When the messages are returned, they will have any ID associated with them. Use that to get an individual message:

You can get the raw message as well:

Get a message's attachments
Get an attachment

When the message's attachments are returned, they will have any ID associated with them. Use that to get an individual message attachment:

Top

Google Client

Like the Google transport, the Google client requires a number of configuration steps to be performed in the Google administration portal and cloud console. This includes setting up the approved application as a service account and its necessary requirements. When that is complete, you should be prompted to download a JSON file with the appropriate credentials and data for your application:

You can pass the JSON file directly into Google client object, along with the user email being used. From there, you can request and store the required token for future requests:

When calling the Google client object at a later time, you can reuse the token (if it hasn't expired):

If the token has expired, the client object will automatically refresh it. At this point, you can fetch the new token and its expiration from the client object and store them.

From there you can interact with the client to fetch messages and their content.

Get messages

Search for unread messages only, limit 5:

Get a message

When the messages are returned, they will have any ID associated with them. Use that to get an individual message:

You can get the raw message as well:

Get a message's attachments
Get an attachment

When the message's attachments are returned, they will have any ID associated with them. Use that to get an individual message attachment:

Top

IMAP/POP3

IMAP & POP3 clients are available, but are becoming less supported. Their usage has been deprecated in some popular enterprise mail platforms. Use with caution.

Top

Mail Queues

You can create a mail queue to manage and send messages to multiple recipients at the same time. The benefit is that the body of the messages can contain placeholders that can be swapped for individual user data for customization and a better user experience.

Top

Saving Mail

By saving mail messages to a storage location within your application, you can call them up at a later date and time to send them from that location.

Top


All versions of pop-mail with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1.0
popphp/pop-http Version ^5.1.1
popphp/pop-mime Version ^2.0.0
popphp/pop-utils Version ^2.1.0
google/apiclient Version ^v2.15.1
aws/aws-sdk-php Version ^3.283.9
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 popphp/pop-mail contains the following files

Loading the files please wait ....