Download the PHP package khaleejinfotech/multi-tenant-mailer without Composer

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

Multi Tenant Mailer

GitHub Issues or Pull Requests GitHub Tag GitHub contributors GitHub Repo stars

The MultiTenantMailer is a powerful and flexible email-sending library designed for multi-tenant applications. It simplifies the process of configuring and sending emails while supporting multiple tenants with different settings.

Features

Installation

  1. Install via Composer: If you haven't done so, install the package using Composer:

  2. Register the service provider: Open your config/app.php file and add the service provider to the providers array.

    bash php artisan vendor:publish --provider="Khaleejinfotech\MultiTenantMailer\MultiTenantMailerServiceProvider"

Configuration

You can configure the queue_class in the published configuration file (config/multi-tenant-mailer.php) like this:

Usage

MultiTenantMailer

Initialize the Mailer

Set Email Properties

Send the Email

MultiTenantMailerSettings

Create and Configure Settings

by this you can directly pass the settings object to the mailer instance.
Here is the example

Using Facades

If you prefer to use facades for cleaner syntax, you can utilize the facades you've created.

Using MultiTenantMailer Facade

Using MultiTenantMailerSettings Facade

Notification Driver Support

the setBody() can have either Notification/Mailable or the self mailable method to render the message;

1. Notification/Mailable Object

2. Self $this->toMail($notifiable)->render() method

Queues

The MultiTenantMailer class provides the ability to define specific queues for processing emails, giving you control over how and when emails are queued.

Setting the Queue

You can set a queue name or identifier using the setOnQueue method. This allows you to specify a queue that suits your system’s job-handling requirements.

Events

The library includes the following events:

MailFailed: Triggered when sending an email fails.

MailSuccess: Triggered when an email is sent successfully.

Available Methods

Class MultiTenantMailer

Method Summary
init(string $host, int $port, string $username, string $password, string $encryption) Initializes mailer settings.
withSettings(MultiTenantMailerSettings $mailerSettings) Sets mailer settings from a MultiTenantMailerSettings instance.
setHost(string $host) Sets the mail server host.
getHost(): string Retrieves the mail server host.
setPort(int $port) Sets the mail server port.
getPort(): int Retrieves the mail server port.
setUsername(string $username) Sets the username for the mail server.
getUsername(): string Retrieves the username for the mail server.
setPassword(string $password) Sets the password for the mail server.
getPassword(): string Retrieves the password for the mail server.
setEncryption(string $encryption) Sets the encryption type (e.g., 'tls', 'ssl').
getEncryption(): string Retrieves the encryption type.
setTo(array\|string $addresses, string $name = null) Sets the recipient's email address(es) and optional name.
getToAddresses(): array\|string Retrieves the recipient's email address(es).
getToName(): ?string Retrieves the name of the recipient.
setCc(array $addresses) Sets the cc recipient's email address(es) .
getCcAddresses(): array Retrieves the cc recipient's email address(es).
setBcc(array $addresses) Sets the bcc recipient's email address(es) .
getBccAddresses(): array Retrieves the bcc recipient's email address(es).
setFrom(array\|string $addresses, string $name = null) Sets the sender's email address(es) and optional name.
getFromAddresses(): array\|string Retrieves the sender's email address(es).
getFromName(): ?string Retrieves the name of the sender.
setSubject(string $subject) Sets the email subject.
setContentType(string $contentType = 'text/html') Sets the content type (e.g., 'text/html').
shouldQueue() Marks the email to be queued for sending.
isShouldQueue(): bool Checks if the email should be queued.
onQueue(BackedEnum\|string\|null $onQueue = 'default') Sets the job queue name.
getQueue(): BackedEnum\|string\|null $onQueue Retrieves the job queue name.
getStreamOptions(): null\|array Get the stream options.
setStreamOptions(): null\|array Set the stream options.
setBody(Notification\|string $notification) Sets the email body, either from a notification or a plain string.
getBody(): string Retrieves the email body.
setBodyPart(string $bodyPart) Sets the plain text body part of the email.
getBodyPart(): string Retrieves the plain text body part of the email.
setAttachments(array $attachments) Sets attachments for the email.
getAttachments(): array Retrieves the attachments for the email.
setHeaders(array $headers) Sets headers for the email.
getHeaders(): array Retrieves the headers for the email.
useFallbackConfig() Sets default email settings if there is no email config set.
stopTransport(bool $b) Define whether to keep transport running or stopped..
shouldStopTransport(): bool To stop the transport.
setExtras(array\|string $key, mixed $value) Defines extra data to be used by the mailer.
getExtras(): array Returns the array of extra data.
send(): int Sends the email and returns the number of emails sent.

Class MultiTenantMailerSettings

Method Summary
setHost(string $host) Sets the mail server host for the settings.
getHost(): string Retrieves the mail server host from the settings.
setPort(int $port) Sets the mail server port for the settings.
getPort(): int Retrieves the mail server port from the settings.
setUsername(string $username) Sets the username for the mail server in the settings.
getUsername(): string Retrieves the username for the mail server from the settings.
setPassword(string $password) Sets the password for the mail server in the settings.
getPassword(): string Retrieves the password for the mail server from the settings.
setEncryption(string $encryption) Sets the encryption type (e.g., 'tls', 'ssl') in the settings.
getEncryption(): string Retrieves the encryption type from the settings.
setFromName(string $name = null) Sets the sender's name in the settings.
getFromName(): ?string Retrieves the sender's name from the settings.
setFromAddress(string $addresses, string $name = null) Sets the sender's email address and optional name in the settings.
getFromAddress(): ?string Retrieves the sender's email address from the settings.

Exception Handling

The MultiTenantMailer class throws MultiTenantMailerException when the required properties (host, port, username, etc.) are not set. Be sure to handle these exceptions to avoid runtime errors.

Contributing

Contributions are welcome! Please submit a pull request or open an issue for any improvements or bugs you encounter.


All versions of multi-tenant-mailer with dependencies

PHP Build Version
Package Version
Requires swiftmailer/swiftmailer Version ^5.4
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 khaleejinfotech/multi-tenant-mailer contains the following files

Loading the files please wait ....