Download the PHP package dotkernel/dot-mail without Composer

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

dot-mail

DotKernel mail component based on laminas-mail

OSS Lifecycle PHP from Packagist (specify version)

GitHub issues GitHub forks GitHub stars GitHub license

Build Static codecov

SymfonyInsight

Configuration

Mail - Sendmail

If your server has Sendmail installed, update the config/autoload/mail.local.php.dist file by setting the transport key like below

Mail - SMTP

If you want your application to send mails on e.g. registration, contact, then edit the file config/autoload/mail.local.php. Set the transport, message_options and smtp_options keys like below.

Under message_options key:

Under smtp_options key:

Note: all other keys can be left as is.

In config/autoload/local.php add under contact => message_receivers => to key string values with the emails that should receive contact messages

Note: Please add at least 1 email address in order for contact message to reach someone

Also feel free to add as many cc as you want under contact => message_receivers => cc key

Sending an e-mail

Below is an example of how to use the email in the most basic way. You can add your own code to it e.g. to get the user data from a User object or from a config file, to use a template for the body.

Note that addTo is only one of the methods available for the Message class returned by getMessage(). Other useful methods that were not included in the example are addCc(), addBcc(), addReplyTo().

The returned type is boolean, but if the isValid() method is removed, the returned type becomes MailResult which allows the use of getMessage() for a more detailed error message. See the Testing if an e-mail message is valid section below.

It's optional, but recommended to call the above function in a try-catch block to display helpful error messages. The next example calls the sendBasicMail function from within UserController, but you can implement it in other controllers, just make sure that the controller's construct also includes the FlashMessenger parameter $messenger.

Testing if an e-mail message is valid

After sending an e-mail you can check if the message was valid or not. The $this->mailService->send()->isValid() method call will return a boolean value. If the returned result is true, the e-mail was valid, otherwise the e-mail was invalid. In case your e-mail was invalid, you can check for any errors using $this->mailService->send()->getMessage().

Using the below logic will let you determine if a message was valid or not and log it. You can implement your own custom error logging logic.

` Note : Invalid e-mail messages will not be sent.

Logging outgoing emails

Optionally, you can keep a log of each successfully sent email. This might be useful when you need to know if/when a specific email has been sent out to a recipient.

Logs are stored in the following format: [YYYY-MM-DD HH:MM:SS]: {"subject":"Test subject","to":["Test Account <[email protected]>"],"cc":[],"bcc":[]}.

By default, this feature is disabled.

In order to enable it, make sure that your config/autoload/mail.local.php has the below log configuration under the dot_mail key:

To disable it again, set the value of sent to null.

Saving a copy of an outgoing mail into a folder

Valid only for SMTP Transport

First, make sure the save_sent_message_folder key is present in config file mail.local.php under dot_mail.default. Below you can see its placement and default value.

Common folder names are INBOX, INBOX.Archive, INBOX.Drafts, INBOX.Sent, INBOX.Spam, INBOX.Trash. If you have MailService available in your class, you can call $this->mailService->getFolderGlobalNames() to list the folder global names for the email you are using.

Multiple folders can be added to the save_sent_message_folder key to save a copy of the outgoing email in each folder.


All versions of dot-mail with dependencies

PHP Build Version
Package Version
Requires php Version ~8.1.0 || ~8.2.0 || ~8.3.0
ext-fileinfo Version *
ext-json Version *
laminas/laminas-servicemanager Version ^3.22.1
laminas/laminas-mail Version ^2.25.1
dotkernel/dot-event Version ^3.4.2
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 dotkernel/dot-mail contains the following files

Loading the files please wait ....