Skip to content

Commit

Permalink
Merge branch 'release/v2.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderpotjer committed Jun 2, 2022
2 parents 00bdb7f + 9b82052 commit e58b354
Show file tree
Hide file tree
Showing 6 changed files with 193 additions and 420 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

Mailchimp Transactional mailer adapter for Craft CMS.

## 2.0.0 - 2022-06-02
### Added
- Added Craft 4 compatibility.
-
### Changed
- Using Symfony Mailer rather than Swift Mailer.

## 1.0.3 - 2022-03-30
### Fixed
- Improve the Mailchimp Transactional API response error logging (thanks @nstCactus)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This plugin provides a [Mailchimp Transactional](https://mailchimp.com/features/

## Requirements

This plugin requires Craft CMS 3.7.0 or later.
This plugin requires Craft CMS 4.0 or later.

## Installation

Expand Down
17 changes: 13 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
"name": "perfectwebteam/craft-mailchimp-transactional",
"description": "Mailchimp Transactional mailer adapter for Craft CMS.",
"type": "craft-plugin",
"version": "1.0.3",
"keywords": [
"craft",
"cms",
"craftcms",
"craft-plugin",
"mailchimp transactional",
"mailchimp",
"transactional"
"transactional",
"mandrill"
],
"support": {
"docs": "https://github.com/perfectwebteam/craft-mailchimp-transactional/blob/main/README.md",
Expand All @@ -25,8 +25,8 @@
}
],
"require": {
"craftcms/cms": "^3.7.0",
"mailchimp/transactional": "*"
"php": "^8.0.2",
"craftcms/cms": "^4.0.0"
},
"autoload": {
"psr-4": {
Expand All @@ -41,5 +41,14 @@
"documentationUrl": "https://github.com/perfectwebteam/craft-mailchimp-transactional/blob/main/README.md",
"changelogUrl": "https://raw.githubusercontent.com/perfectwebteam/craft-mailchimp-transactional/main/CHANGELOG.md",
"class": "perfectwebteam\\mailchimptransactional\\MailchimpTransactional"
},
"config": {
"platform": {
"php": "8.0.2"
},
"allow-plugins": {
"yiisoft/yii2-composer": true,
"craftcms/plugin-installer": true
}
}
}
2 changes: 1 addition & 1 deletion src/MailchimpTransactional.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Mailchimp Transactional plugin for Craft CMS 3.x
* Mailchimp Transactional plugin for Craft CMS
*
* @link https://perfectwebteam.com
* @copyright Copyright (c) 2022 Perfect Web Team
Expand Down
36 changes: 18 additions & 18 deletions src/mail/MailchimpTransactionalAdapter.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Mailchimp Transactional plugin for Craft CMS 3.x
* Mailchimp Transactional plugin for Craft CMS
*
* @link https://perfectwebteam.com
* @copyright Copyright (c) 2022 Perfect Web Team
Expand All @@ -10,9 +10,9 @@

use Craft;
use craft\behaviors\EnvAttributeParserBehavior;
use craft\helpers\App;
use craft\mail\transportadapters\BaseTransportAdapter;
use Swift_Events_SimpleEventDispatcher;
use Swift_Transport;
use Symfony\Component\Mailer\Transport\AbstractTransport;

/**
* Mailchimp Transactional Adaptor
Expand All @@ -36,17 +36,17 @@ public static function displayName(): string
/**
* @var string The API key that should be used
*/
public $apiKey;
public string $apiKey;

/**
* @var string The subaccount that should be used
*/
public $subaccount;
public string $subaccount;

/**
* @var string The template that should be used
*/
public $template;
public string $template;

/**
* @inheritdoc
Expand Down Expand Up @@ -98,18 +98,18 @@ public function getSettingsHtml(): ?string
/**
* @inheritdoc
*/
public function defineTransport(): array
public function defineTransport(): array|AbstractTransport
{
return [
'class' => MailchimpTransactionalTransport::class,
'constructArgs' => [
[
'class' => Swift_Events_SimpleEventDispatcher::class
]
],
'apiKey' => Craft::parseEnv($this->apiKey),
'subAccount' => Craft::parseEnv($this->subaccount) ?: null,
'template' => Craft::parseEnv($this->template) ?: null
];
$transport = new MailchimpTransactionalTransport(App::parseEnv($this->apiKey));

if ($this->template) {
$transport->setTemplate(App::parseEnv($this->template));
}

if ($this->subaccount) {
$transport->setSubaccount(App::parseEnv($this->subaccount));
}

return $transport;
}
}
Loading

0 comments on commit e58b354

Please sign in to comment.