Download the PHP package slm/mail without Composer
On this page you can find all versions of the php package slm/mail. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package mail
Short Description Integration of various email service providers in the Laminas\Mail
License BSD-3-Clause
Homepage https://github.com/Webador/SlmMail
Informations about the package mail
SlmMail
SlmMail is a module that integrates with various third-parties API to send mails. Integration is provided with the API of those services. It does not handle SMTP.
Here are the currently supported services:
- Elastic Email (complete)
- Mailgun (complete)
- Postmark (complete)
- Postage (complete)
- SendGrid (nearly complete)
- SparkPost (nearly complete)
- Amazon SES (nearly complete, attachments are missing)
- Mandrill (complete, but please don't use this party, as Mailchimp / Mandrill do not actively maintain this service)
Installation
-
First install the repo:
composer require slm/mail
- For Laminas MVC add
SlmMail
in yourapplication.config.php
file. - For Mezzio it should prompt whether we want to autoconfigure. Accept this.
- For Laminas MVC add
-
In order to use a mail service, you now need to configure it. We have provided a sample configuration file per mail server.
Copy the sample configuration file to your autoload directory. For example for Mandrill one would use
cp vendor/slm/mail/config/slm_mail.mandrill.local.php.dist config/autoload/slm_mail.mandrill.local.php
Please tweak the dummy contents in this file. This file will contain the credentials.
Usage
One can now fetch the dependencies from the service manager. And now compose a message:
`
Documentation
Documentation for SlmMail is splitted for each provider:
- Elastic Email
- Mailgun
- Mandrill
- Postage
- Postmark
- SendGrid
- SparkPost
- Amazon SES
Cook-book
How to send an HTML email ?
Every email providers used in SlmMail allow to send HTML emails. However, by default, if you set the mail's content
using the setBody
content, this content will be considered as the plain text version as shown below:
To send a HTML version, you must specify the body as a MimeMessage, and add the HTML version as a MIME part, as shown below:
For accessibility purposes, you should always provide both a text and HTML version of your mails.
multipart/alternative
emails with attachments
The correct way to compose an email message that contains text, html and attachments is to create a
multipart/alternative
part containing the text and html parts, followed by one or more parts for the attachments. See
the Laminas Documentation
for a full example.
How to configure HttpClient with http_options and http_adapter
By default the adapter is Laminas\Http\Client\Adapter\Socket but you can override it with other adapter like this in your slm_mail.*.local.php
If you want to change some options of your adapter please refer to you adapter class in var $config here and override these in your slm_mail.*.local.php like this :
Which provider should I choose?
We won't answer you :-)! Each provider has their own set of features. You should carefully read each website to discover which one suits your needs best.
Who to thank?
Jurian Sluiman and Michaël Gallego did the initial work on creating this repo, and maintained it for a long time.
Currently it is maintained by:
All versions of mail with dependencies
laminas/laminas-mail Version ^2.9
laminas/laminas-http Version ^2.8
laminas/laminas-mime Version ^2.8
laminas/laminas-servicemanager Version ^3.11