SlmMail is a module that integrates with various third-parties API to send mails. Integration is provided with the API of those services

Overview

SlmMail

Build Status Latest Stable Version Scrutinizer Code Quality

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:

Installation

  1. First install the repo:

    composer require slm/mail

    • For Laminas MVC add SlmMail in your application.config.php file.
    • For Mezzio it should prompt whether we want to autoconfigure. Accept this.
  2. 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:

$message = new \Laminas\Mail\Message();
$message
    ->setTo('send@to')
    ->setFrom('send@by')
    ->setSubject('Subject')
    ->setBody('Contents');

$mandrillService = $container->get(\SlmMail\Service\MandrillService::class);
$mandrillService->send($message);

Documentation

Documentation for SlmMail is splitted for each provider:

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:

$message = new \Laminas\Mail\Message();

// This will be considered as plain text message, even if the string is valid HTML code
$message->setBody('Hello world');

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:

type = "text/plain"; $body = new \Laminas\Mime\Message(); $body->setParts(array($textPart, $htmlPart)); $message->setBody($body);">
$message = new \Laminas\Mail\Message();

$htmlPart = new \Laminas\Mime\Part('

Hello world

'
); $htmlPart->type = "text/html"; $textPart = new \Laminas\Mime\Part('Hello world'); $textPart->type = "text/plain"; $body = new \Laminas\Mime\Message(); $body->setParts(array($textPart, $htmlPart)); $message->setBody($body);

For accessibility purposes, you should always provide both a text and HTML version of your mails.

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

'slm_mail' => array(
    // Here your email service provider options

    'http_adapter' => 'Laminas\Http\Client\Adapter\Proxy' // for example
)

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 :

'slm_mail' => array(
    // Here your email service provider options

    // example for Socket adapter
    'http_options' => array(
        'sslverifypeer' => false,
        'persistent' => true,
    ),
)

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:

Comments
  • Refactor SlmMail

    Refactor SlmMail

    Hej @juriansluiman,

    I started to think about SlmMail.

    Basically, I've removed all the Di stuff, all the message, services... As I told you some weeks ago, I think it makes no sense to have the service send the message. To my opinion this is transport role.

    I think a lot of logic could be moved to AbstractHttpTransport, by making each transport filling a kind of "descriptor" (for instance, say that from email is stored in "from_email" in params), so that we don't duplicate the boring stuff accross all transports.

    I also think we must separate Transactional emails and Campaign emails. I suppose we should add a "Campaign" namespace into SlmMail to handle Campaign and List (List could extend from AddressList and implements custom logic).

    opened by bakura10 20
  • Extending SES to support setTemplate and passing data to the template.

    Extending SES to support setTemplate and passing data to the template.

    Hi, My primary usage for the mail is using AWS SES . While this module supports that, but I don't see anywhere to set a template for the same. I am not sure how to do this. Would be great if someone could outline how to extend it so that it will support setTemplate and passing data to the template page . It would be great if the module starts supporting sendy.

    opened by shadow-fox 17
  • PostmarkService::parseResponse ist obfuscating response details

    PostmarkService::parseResponse ist obfuscating response details

    By throwing your own generic exception in https://github.com/juriansluiman/SlmMail/blob/master/src/SlmMail/Service/PostmarkService.php#L350 you're reducing information and obfuscating the true reason for failure.

    It must be possible for the consumer to process the response from postmark. Either make the response available or pass it to the exception as context so it can be extracted in a catch block.

    opened by markushausammann 13
  • SendGrid Attachments

    SendGrid Attachments

    I have been using this module with SendGrid and just started sending attachments. Oddly, my excel files were "corrupted" and easily fixed by excel, but the byte size did not match what I sent it (~100 bytes more).

    I dug into the SendGridService and see this line:

    $post->set('files[' . $attachment->filename . ']', $attachment->getRawContent() . ';type=' . $attachment->type);
    

    However, this is not correct as the type is being appended to the end of the file. Removing this fixed my corruption issue. I recommend removing this line from production because ";type=whatever" is not a standard file protocol. I don't mind doing this and pull requesting.

    Line should be:

    $post->set('files[' . $attachment->filename . ']', $attachment->getRawContent());
    
    bug 
    opened by sb8244 13
  • Boom! Make SlmMail compatible with Zend\Mail\Transport

    Boom! Make SlmMail compatible with Zend\Mail\Transport

    This makes it possible to use it with stuff like SxMail and other modules relying on Zend\Mail\TransportInterface.

    Frankly, I think this interface should be dropped in favor of Zend\Mail\TransportInterface, as they are identical.

    opened by Thinkscape 13
  • Add testMode to SlmMail

    Add testMode to SlmMail

    I've started work on adding a test_mode config value.

    When test_mode is true, SlmMail wont actually send any emails. This is needed when doing QA or testing. You might want to test with real costumer data, but not actually sending emails.

    Right now when test_mode is true i just return an array instead of doing the actual $response->send. I don't know if this is the right way to do it?

    Will add unit-test when i've gotten clarified if return array() is correct.

    opened by Danielss89 12
  • SES - Enhancement request: switch to latest Aws ZF2 module

    SES - Enhancement request: switch to latest Aws ZF2 module

    It appears that this is presently undocumented so I'll at least list this as an issue. This module depends on the older version of the AWS ZF2 module and not on the latest version.

    Converting to a newer version looks to be as simple as modifying SesServiceFactory to:

    namespace SlmMail\Factory;
    
    use SlmMail\Service\SesService;
    use Zend\ServiceManager\FactoryInterface;
    use Zend\ServiceManager\ServiceLocatorInterface;
    use Aws\Sdk;
    
    class SesServiceFactory implements FactoryInterface
    {
    
        /**
         *
         * {@inheritDoc}
         *
         */
        public function createService(ServiceLocatorInterface $serviceLocator)
        {
            return new SesService($serviceLocator->get(Sdk::class)->createSes());
        }
    }
    

    Is this something that is planned in the near future? I realize that this may also affect other modules like SlmQueue and should probably be committed in parallel for projects that depends on both SlmQueue as well as SlmMail.

    opened by jackdpeterson 11
  • Install SlmMail with zf2 dev-develop

    Install SlmMail with zf2 dev-develop

    This is my composer.json file

    { "name": "test site", "description": "test site", "license": "BSD-3-Clause", "minimum-stability": "dev", "repositories": [ { "type": "composer", "url": "https://packages.zendframework.com/" } ], "require": { "php": ">=5.3.3", "zendframework/zendframework": "dev-develop", "zfcampus/zf-apigility": "dev-master", "doctrine/doctrine-orm-module":"0.", "doctrine/common": "2.3.0", "silvester/reverse-oauth2": "dev-master", "FortAwesome/Font-Awesome": "", "aws/aws-sdk-php-zf2": "1.0.", "codeception/codeception": "1.8.", "neilime/zf2-assets-bundle": "dev-master", "ocramius/ocra-service-manager": "dev-master" }, "require-dev": { "zendframework/zftool": "dev-master", "zendframework/zend-developer-tools": "dev-master" } }

    I need to install the SlmMail package but it give lot of dependency errors. How can I install SlmMail package with above configs.

    opened by ppeiris 10
  • Enhance documentation

    Enhance documentation

    For the final 1.0.0 release, let's make the documentation better.

    @juriansluiman, there are some parts here https://github.com/juriansluiman/SlmMail/issues/7, I don't know how to do them better. The installation is already short enough. What kind of description would you like in Introduction ?

    opened by bakura10 10
  • Add attachment support for Amazon SES

    Add attachment support for Amazon SES

    It seems that Amazon SES now support attachments (in fact it supports them since 2011, don't know why I didn't see it): http://aws.typepad.com/aws/2011/07/amazon-simple-email-service-now-supports-attachments.html).

    We will need:

    • To add a SesMessage class
    • Change the send method in service to send attachments using the SendRawEmail method.

    Any SES user is encouraged to do it =)

    opened by bakura10 9
  • Services sending HTML and text incorrectly

    Services sending HTML and text incorrectly

    Each of the services' sendMessage() methods has a section like this:

    $params = array(
        'subject'  => $message->getSubject(),
        'html'     => $message->getBody(),
        'text'     => $message->getBodyText(),
    );
    

    There is a bug here and and it's root is a misunderstanding of getBody() and getBodyText().

    The difference between these two methods is that the former returns an object and the latter a string (the contents of the object). Unlike ZF1, the message doesn't include the fields for HTML and text: they are objects of type \Zend\Mime\Message.

    Most services allow for sending HTML and/or text, so the service should support that aswell.

    The code should check the 'content-type' of each mime part in the message body and decide whether it's HTML or text. Then send only the types that exist to the server.

    Am I missing anything?

    bug 
    opened by moteutsch 9
  • Companies using SlmMail

    Companies using SlmMail

    I'm interested to know how many companies are actually using SlmMail for their company. Feel free to drop a comment below with a link to your product. I'll update the issue with these responses.

    • Webador, a DIY website builder.
    • Research Square, a preprint platform and an academic author services company.
    • Bright Answer, part of tool that builds custom online research and psychometrics solutions.
    • Tiki24 to let their customers send mail using different adapters.
    question 
    opened by roelvanduijnhoven 4
  • Mailgun: support templates

    Mailgun: support templates

    Hello,

    I use Mandrill for months, but since it's not free anymore, I'm going to use Mailgun. I saw there is a template feature in Mailgun, but nothing in the SlmMail Mailgun support.

    Is it a missing feature ? Or I'm missing something ?

    Thanks for your awesome work !

    enhancement 
    opened by Colmea 1
  • Postage: add support for recipient variables

    Postage: add support for recipient variables

    While doing a quick overview of what's new in all the API we support, I realized that Postage support variables per recipient. We only support global variables. (Reference: http://help.postageapp.com/kb/api/send_message)

    I suggest:

    • Renaming getVariables to getGlobalVariables (as in Mandrill, and because it makes sense)
    • Adding a getVariables which take recipient address as first parameter (as in Mandrill).

    As this is a BC, we may do it for 2.0 (I don't think it's a big deal to iterate quickly, as SlmMail is really working well, I see no problem at quickly having another major version for such things).

    enhancement 
    opened by bakura10 2
Releases(v4.2.4)
  • v4.2.4(Jul 21, 2022)

    Changes:

    • Make transport interface inherit from Laminas\Mail\Transport\TransportInterface. That makes it possible to simply plug-in Laminas Transport adapters. Thanks @shauno.
    Source code(tar.gz)
    Source code(zip)
  • v4.2.3(Jan 24, 2022)

  • v4.2.2(Jan 13, 2022)

  • v4.2.1(Dec 13, 2021)

    • You can now set return_path for Sparkpost.
    • Possible BC break due to upgraded Guzzle dependency in dev autoload. That is why we bumped minor version.
    Source code(tar.gz)
    Source code(zip)
  • v4.1(Aug 12, 2021)

  • v4.0(Jun 30, 2021)

    This support brings PHP8 support. Thanks to @snapshotpl for that :pray:

    Change for SES users

    We no longer use https://github.com/aws/aws-sdk-php-zf2, as that repo was not maintained anymore. Instead, you should now require aws-sdk-php and configure config/slm_mail.ses.local.php.dist.

    Source code(tar.gz)
    Source code(zip)
  • v4.0-alpha(Jun 29, 2021)

    This support brings PHP8 support. Thanks to @snapshotpl for that :pray:

    Change for SES users

    We no longer use https://github.com/aws/aws-sdk-php-zf2, as that repo was not maintained anymore. Instead, you should now require aws-sdk-php and configure config/slm_mail.ses.local.php.dist.

    Source code(tar.gz)
    Source code(zip)
  • v3.4(May 19, 2021)

  • v3.3(Jul 1, 2020)

  • v3.1(Feb 8, 2020)

    MailGun service will not follow the attachments disposition.

    Note this could be a breaking change: before all attachments were attached as attachment. So if you pass along an attachment with an inline disposition, it will not appear inline. As before it would simply be attached.

    Source code(tar.gz)
    Source code(zip)
  • v3.0(Feb 3, 2020)

    This new major release features:

    • We now target Laminas instead of Zend Framework.
    • We now target PHP 7.2 and above.
    • Types were introduced. These types are identical to the DocTypes that were present before. However note that the new types could be too strict or wrong. Please raise an issue if that is the case.
    • Repository moved to JouwWeb organization.

    Deprecation:

    • PHP 7.1 and below are no longer working. Use the 2.x branch for this.
    • Zend Framework is no longer supported. Use the 2.x branch for this.
    • Types were introduced to almost all methods. These types are identical to the PHPDocs, so it should not break your code in theory. However there is a possibility that you did pass other stuff to those methods.

    This first release is an alpha build.

    Source code(tar.gz)
    Source code(zip)
  • v3.0-alpha(Jan 30, 2020)

    This new major release features:

    • We now target Laminas instead of Zend Framework.
    • We now target PHP 7.2 and above.
    • Types were introduced. These types are identical to the DocTypes that were present before. However note that the new types could be too strict or wrong. Please raise an issue if that is the case.
    • Repository moved to JouwWeb organization.

    Deprecation:

    • PHP 7.1 and below are no longer working. Use the 2.x branch for this.
    • Zend Framework is no longer supported. Use the 2.x branch for this.
    • Types were introduced to almost all methods. These types are identical to the PHPDocs, so it should not break your code in theory. However there is a possibility that you did pass other stuff to those methods.

    This first release is an alpha build.

    Source code(tar.gz)
    Source code(zip)
  • v2.1.2(May 15, 2017)

    • ElasticEmail API endpoint /send tell us to use POST method instead of GET. So, when sending big html messages via GET it returns 414 error. Fixed to use POST in the method send of the ElasticEmailService.php
    Source code(tar.gz)
    Source code(zip)
  • v2.1.1(Apr 17, 2017)

    • MailGun API endpoint /logs is deprecated. So, you should use the getEvents function instead of getLogs from MailGunService.php.
    • Small fix in the ElasticMail Api return's when authentication fails.
    • Small PHP syntax's fixes
    Source code(tar.gz)
    Source code(zip)
  • v2.1.0(Oct 10, 2016)

    • Added ZF3 support -- which allow install zend-servicemanager both versions v2 or v3 by composer
    • Updated & reduced composer dependencies (dropped install full ZF2 framework)
    • Small PHP syntax's fixes & added gitignore file
    Source code(tar.gz)
    Source code(zip)
  • v2.0.0(Jul 7, 2016)

  • v1.6.0(Jan 15, 2016)

  • v1.5.3(May 4, 2015)

  • v1.5.2(Dec 31, 2014)

  • v1.5.1(Nov 7, 2014)

    First patch release of SlmMail v1.5.1

    • Fix small typo in README to include ~1.5
    • Remove unnecessary import statements in code base
    • Return API status codes in Postage/Postmark api exceptions
    Source code(tar.gz)
    Source code(zip)
  • v1.5.0(Jun 13, 2014)

    Fifth feature release of SlmMail:

    • You can now schedule Mandrill emails in the future by using the optional sendAt variable in both send and sendTemplate methods.
    • getScheduledMessages, cancelScheduledMessage and rescheduleMessage methods have been also added to the Mandrill service to handle those messages.
    • AlphaMail is dead and no longer operates. It is therefore removed from SlmMail.
    Source code(tar.gz)
    Source code(zip)
  • v1.4.1(Apr 14, 2014)

    First hotfix release of v1.4 series

    • Suggest in the README to load ~1.4 by default
    • Fix Sendgrid attachment issues with Outlook clients [#70]
    Source code(tar.gz)
    Source code(zip)
  • v1.4.0(Apr 4, 2014)

    Fourth feature release of SlmMail:

    • Mailgun users can now use batch sending. You can now send the same email to multiple recipients in one API call.
    Source code(tar.gz)
    Source code(zip)
Owner
Webador
Your website, your way
Webador
Sending Email via Microsoft Exchange Web Services made Easy!

Send Mail via Exchange Web Services! Sending Email via Microsoft Exchange Web Services (EWS) made easy! Installation Install via Composer composer req

Raju Rayhan 19 Jul 19, 2022
Send email across all platforms using one interface

Send email across all platforms using one interface. Table Of Content Requirements Installation Providers AmazonSES Mailgun Mailjet Mandrill Postmark

Omnimail 329 Dec 30, 2022
Queue, preview and and send emails stored in the database.

Codeigniter4 email queue Queue, preview and and send emails stored in the database. This package provides an interface for creating emails on the fly

null 3 Apr 12, 2022
Send beautiful HTML emails with Laravel

Beautymail for Laravel Beautymail makes it super easy to send beautiful responsive HTML emails. It's made for things like: Welcome emails Password rem

null 1.1k Jan 2, 2023
A Laravel package to check if you can send e-mail through a given mailserver in name of a given e-mail address

A Laravel package to check if you can send e-mail through a given mailserver in name of a given e-mail address Mail spf checker A Laravel package to c

Dieter Coopman 110 Dec 16, 2022
Provides Amazon SES integration for Symfony Mailer

Amazon Mailer Provides Amazon SES integration for Symfony Mailer. Resources Contributing Report issues and send Pull Requests in the main Symfony repo

Symfony 49 Nov 7, 2022
Yii Framework Symfony Mailer Integration

Yii Mailer Library - Symfony Mailer Extension This package is an adapter for yiisoft/mailer relying on symfony/mailer. Requirements PHP 7.4 or higher.

Yii Software 9 Oct 26, 2022
Magento 2 SMTP - AVADA Email Marketing Integration

SMTP Extension for Magento 2 allows the owner offer a Magento 2 store to custom SMTP (Simple Mail Transfer Protocol) server which transmits email messages. Through the SMTP server, messages will be delivered directly and automatically to the chosen customers. It offers flexible configurations with 21 different SMTP servers such as Gmail, Hotmail, O2 Mail, Office365, Mail.com, Send In Blue, AOL Mail Orange, GMX, Outlook, Yahoo, Comcast, or Custom SMTP - for your own SMTP server, etc.

Yodo1117 1 Jan 25, 2022
This module is the core of phpList 4

phpList core module About phpList phpList is an open source newsletter manager. This project is a rewrite of the original phpList. About this package

phpList 84 Dec 23, 2022
Mail sending module for Mezzio and Laminas MVC with support for file attachment and template email composition

This module provides an easy and flexible way to send emails from Mezzio and Laminas MVC applications (formerly known as Zend Expressive and Zend MVC). It allows you to pre-configure emails and transports, and then send those emails at runtime.

null 82 Jan 16, 2022
Laravel IMAP is an easy way to integrate both the native php-imap module and an extended custom imap protocol into your Laravel app.

Laravel IMAP is an easy way to integrate both the native php-imap module and an extended custom imap protocol into your Laravel app. This enables your app to not only respond to new emails but also allows it to read and parse existing mails and much more.

null 530 Jan 6, 2023
Magento 2 Email Catcher or Email Logger Module.

Magento 2 Module Experius email catcher / - logger

Experius 49 Dec 16, 2021
Stampie is a simple API Wrapper for different email providers such as Postmark and SendGrid.

Stampie Stampie is a simple API Wrapper for different email providers such as Postmark and SendGrid. It is very easy to use and to integrate into your

Stampie 289 Dec 5, 2022
Pimcore Bundle that enbable pimcore to expose webook for communication to third parties

WebHookBundle Plugin This extention provide an easy way to send dataobjects to an external sites via json, whenever a pimcore event occurs on a specif

Sintra  - Digital Business 22 Aug 9, 2022
Mail Api for fetch or send mails

flux-mail-api Mail Api for fetch or send mails Installation Native Download RUN (mkdir -p /%path%/libs/flux-mail-api && cd /%path%/libs/flux-mail-api

null 2 Dec 12, 2022
Lightweight PHP library for WhatsApp API to send the whatsapp messages in PHP provided by ultramsg.com

Ultramsg.com WhatsApp API PHP SDK Lightweight PHP library for WhatsApp API to send the whatsappp messages in PHP provided by Ultramsg.com Installation

Ultramsg 117 Dec 26, 2022
A PHP library to deal with all those media services around, parsing their URLs and displaying their audios/videos.

MediaEmbed A utility library that generates HTML embed tags for audio or video located on a given URL. It also parses and validates given media URLs.

Mark Sch. 165 Nov 10, 2022
Helper script to aid upgrading magento 2 websites by detecting overrides. Now supports third party module detections

ampersand-magento2-upgrade-patch-helper Helper scripts to aid upgrading magento 2 websites, or when upgrading a magento module This tool looks for fil

Ampersand 242 Dec 18, 2022
BraincraftedBootstrapBundle integrates Bootstrap into Symfony2 by providing templates, Twig extensions, services and commands.

BraincraftedBootstrapBundle BraincraftedBootstrapBundle helps you integrate Bootstrap in your Symfony2 project. BootstrapBundle also supports the offi

Braincrafted 403 Aug 13, 2022
The Laravel eCommerce Image Gallery allows the admin to add/manage images into various galleries and galleries into various groups according to requirements.

The Laravel eCommerce Image Gallery allows the admin to add/manage images into various galleries and galleries into various groups according to requirements.

Bagisto 2 May 31, 2022