Skip to content

Commit 7c15f74

Browse files
committed
Merge branch 'development'
2 parents 4faf790 + b53fcb7 commit 7c15f74

File tree

9 files changed

+67
-23
lines changed

9 files changed

+67
-23
lines changed

.env.template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
POSTMARK_API_KEY=
22
MAILGUN_API_KEY=
33
MAILGUN_DOMAIN=
4+
MAILGUN_BASEURL=

.github/workflows/ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,18 @@ jobs:
2828
runs-on: ubuntu-20.04
2929
steps:
3030
- name: Checkout Repository
31-
uses: actions/checkout@v2
31+
uses: actions/checkout@v3.2.0
3232
with:
3333
fetch-depth: 0
3434

3535
- name: Setup Java
36-
uses: actions/setup-java@v2
36+
uses: actions/setup-java@v3.9.0
3737
with:
38-
distribution: "adopt"
38+
distribution: "temurin"
3939
java-version: "11"
4040

4141
- name: Cache CommandBox Dependencies
42-
uses: actions/cache@v1
42+
uses: actions/cache@v3
4343
if: ${{ true }}
4444
with:
4545
path: ~/.CommandBox/artifacts
@@ -72,7 +72,7 @@ jobs:
7272
7373
- name: Upload Build Artifacts
7474
if: success()
75-
uses: actions/upload-artifact@v2
75+
uses: actions/upload-artifact@v3.1.1
7676
with:
7777
name: ${{ env.MODULE_ID }}
7878
path: |

.github/workflows/gh-release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ jobs:
1010
create-release:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v2
14-
- uses: taiki-e/create-gh-release-action@v1.5.0
13+
- uses: actions/checkout@v3.2.0
14+
- uses: taiki-e/create-gh-release-action@v1.6.1
1515
with:
1616
# Produced by the build/Build.cfc
1717
changelog: changelog.md

.github/workflows/pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
runs-on: ubuntu-20.04
2121
steps:
2222
- name: Checkout Repository
23-
uses: actions/checkout@v2
23+
uses: actions/checkout@v3.2.0
2424

2525
- uses: Ortus-Solutions/[email protected]
2626
with:

.github/workflows/tests.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,19 @@ jobs:
2020
cfengine: [ "lucee@5", "adobe@2018", "adobe@2021" ]
2121
steps:
2222
- name: Checkout Repository
23-
uses: actions/checkout@v2
23+
uses: actions/checkout@v3.2.0
2424

2525
- name: Setup Java
26-
uses: actions/setup-java@v2
26+
uses: actions/setup-java@v3.9.0
2727
with:
28-
distribution: "adopt"
28+
distribution: "temurin"
2929
java-version: "11"
3030

3131
- name: Setup CommandBox CLI
3232
uses: Ortus-Solutions/[email protected]
3333

3434
- name: Cache CommandBox Dependencies
35-
uses: actions/cache@v1
35+
uses: actions/cache@v3
3636
if: ${{ true }}
3737
with:
3838
path: ~/.CommandBox/artifacts
@@ -67,15 +67,15 @@ jobs:
6767
box testbox run --verbose outputFile=test-harness/tests/results/test-results outputFormats=json,antjunit
6868
6969
- name: Publish Test Results
70-
uses: EnricoMi/publish-unit-test-result-action@v1
70+
uses: EnricoMi/publish-unit-test-result-action@v2
7171
if: always()
7272
with:
73-
files: test-harness/tests/results/**/*.xml
73+
junit_files: test-harness/tests/results/**/*.xml
7474
check_name: "${{ matrix.cfengine }} Test Results"
7575

7676
- name: Upload Test Results to Artifacts
7777
if: always()
78-
uses: actions/upload-artifact@v2
78+
uses: actions/upload-artifact@v3.1.1
7979
with:
8080
name: test-results-${{ matrix.cfengine }}
8181
path: |
@@ -90,7 +90,7 @@ jobs:
9090
9191
- name: Upload Debug Logs To Artifacts
9292
if: ${{ failure() }}
93-
uses: actions/upload-artifact@v2
93+
uses: actions/upload-artifact@v3.1.1
9494
with:
9595
name: Failure Debugging Info - ${{ matrix.cfengine }}
9696
path: |

box.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name":"ColdBox Mail Services",
3-
"version":"2.6.2",
3+
"version":"2.7.0",
44
"location":"https://downloads.ortussolutions.com/ortussolutions/coldbox-modules/cbmailservices/@build.version@/[email protected]@.zip",
55
"author":"Ortus Solutions.com <[email protected]",
66
"slug":"cbmailservices",

changelog.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
----
99

1010

11+
## [v2.7.0] => 2023-JAN-16
12+
13+
A big thanks to @richardherbert for all the updates in this release.
14+
15+
### Fixed
16+
17+
* FIXED var scoping of attachments variable
18+
* Updated to handle a response that is not JSON
19+
* 🐛 FIX: Update GHA to avoid deprecated syntax
20+
21+
### Added
22+
23+
* Added test for MAILGUN_BASEURL property
24+
* Updated to make MAILGUN_APIURL optional
25+
* Added support for Mailgun EU region by making MAILGUN_APIURL an optional property with https://api.mailgun.net/v3/ as the default.
26+
27+
### Changed
28+
29+
* Updated all GHA actions to latest versions and moved to use `temurin` Java distributions from adopt due to deprecation of the service.
30+
31+
----
32+
33+
1134
## [v2.6.2] => 2022-DEC-20
1235

1336
### Fixed

models/protocols/MailgunProtocol.cfc

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
* - apikey : The mailgun secret api key
99
* - domain : The mailgun domain to send the email through
1010
*
11+
* An optional property, "baseURL" is required when using an EU region
12+
* - baseURL : The mailgun region where the Mailgun domain was created
13+
*
1114
* @author Scott Steinbeck <[email protected]>
1215
*/
1316
component
@@ -24,7 +27,6 @@ component
2427
MailgunProtocol function init( struct properties = {} ){
2528
variables.name = "Mailgun";
2629
variables.DEFAULT_TIMEOUT = 30; // in seconds
27-
variables.MAILGUN_APIURL = "https://api.mailgun.net/v3/";
2830
// super size it
2931
super.init( argumentCollection = arguments );
3032

@@ -40,6 +42,14 @@ component
4042
throw( message = "ApiKey is Required", type = "MailgunProtocol.PropertyNotFound" );
4143
}
4244

45+
// Check for Base URL property
46+
if ( !propertyExists( "baseURL" ) ) {
47+
// No baseURL key was found, so use the US default.
48+
variables.MAILGUN_APIURL = "https://api.mailgun.net/v3/";
49+
} else {
50+
variables.MAILGUN_APIURL = getProperty( "baseURL" );
51+
}
52+
4353
return this;
4454
}
4555

@@ -101,7 +111,7 @@ component
101111
data.delete( "bodyTokens" ); // cleanup payload
102112

103113
// Process the mail attachments and encode them how mailgun likes them
104-
attachments = arguments.payload
114+
var attachments = arguments.payload
105115
.getMailParams()
106116
.filter( function( thisParam ){
107117
return structKeyExists( arguments.thisParam, "file" );
@@ -185,7 +195,14 @@ component
185195
}
186196

187197
// Inflate HTTP Results
188-
var mailgunResults = deserializeJSON( httpResults.fileContent.toString() );
198+
if( isJSON( httpResults.fileContent.toString() ) ) {
199+
var mailgunResults = deserializeJSON( httpResults.fileContent.toString() );
200+
} else {
201+
results.messages = [ 'Error sending mail. Mailgun returned "#httpResults.fileContent.toString()#".' ];
202+
203+
return results;
204+
}
205+
189206
// Process Mailgun Results
190207
if ( mailgunResults.message eq "Queued. Thank you." ) {
191208
results.error = false;

test-harness/tests/specs/protocols/MailgunProtocolTest.cfc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ component extends="coldbox.system.testing.BaseTestCase" {
1414
variables.mailservice = getInstance( "MailService@cbmailservices" );
1515
variables.apikey = getUtil().getSystemSetting( "MAILGUN_API_KEY", "MAILGUN_API_KEY" );
1616
variables.domain = getUtil().getSystemSetting( "MAILGUN_DOMAIN", "MAILGUN_DOMAIN" );
17+
variables.baseURL = getUtil().getSystemSetting( "MAILGUN_BASEURL", "MAILGUN_BASEURL" );
1718
}
1819

1920
/*********************************** BDD SUITES ***********************************/
@@ -23,15 +24,17 @@ component extends="coldbox.system.testing.BaseTestCase" {
2324
describe( "Mailgun Protocol", function(){
2425
beforeEach( function( currentSpec ){
2526
// Create a mock instance of the protocol.
26-
variables.protocol = createMock( "cbmailservices.models.protocols.MailgunProtocol" ).init( {
27-
apiKey : variables.apikey,
28-
domain : variables.domain
27+
variables.protocol = createMock( "cbmailservices.models.protocols.MailgunProtocol" ).init( {
28+
apiKey : variables.apikey,
29+
domain : variables.domain,
30+
baseURL : variables.baseURL
2931
} );
3032
} );
3133

3234
it( "can be inited correctly", function(){
3335
expect( variables.protocol.propertyExists( "apiKey" ) ).toBeTrue();
3436
expect( variables.protocol.propertyExists( "domain" ) ).toBeTrue();
37+
expect( variables.protocol.propertyExists( "baseURL" ) ).toBeTrue();
3538
} );
3639

3740
it( "data is formatted for sending to mailgun", function(){

0 commit comments

Comments
 (0)