diff --git a/.env_sample b/.env_sample
new file mode 100644
index 0000000..30857f4
--- /dev/null
+++ b/.env_sample
@@ -0,0 +1 @@
+export SENDGRID_API_KEY=''
\ No newline at end of file
diff --git a/.github/workflows/pr-lint.yml b/.github/workflows/pr-lint.yml
new file mode 100644
index 0000000..2f5232b
--- /dev/null
+++ b/.github/workflows/pr-lint.yml
@@ -0,0 +1,15 @@
+name: Lint PR
+on:
+ pull_request_target:
+ types: [ opened, edited, synchronize, reopened ]
+
+jobs:
+ validate:
+ name: Validate title
+ runs-on: ubuntu-latest
+ steps:
+ - uses: amannn/action-semantic-pull-request@v4
+ with:
+ types: chore docs fix feat test misc
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.github/workflows/test-and-deploy.yml b/.github/workflows/test-and-deploy.yml
new file mode 100644
index 0000000..cb4b722
--- /dev/null
+++ b/.github/workflows/test-and-deploy.yml
@@ -0,0 +1,97 @@
+name: Test and Deploy
+on:
+ push:
+ branches: [ '*' ]
+ tags: [ '*' ]
+ pull_request:
+ branches: [ main ]
+ schedule:
+ # Run automatically at 8AM PST Monday-Friday
+ - cron: '0 15 * * 1-5'
+ workflow_dispatch:
+
+jobs:
+ test:
+ name: Test
+ runs-on: ubuntu-latest
+ timeout-minutes: 20
+ strategy:
+ matrix:
+ java: [ 8, 11, 17 ]
+ steps:
+ - name: Checkout smtpapi-java
+ uses: actions/checkout@v2
+
+ - name: Set up Java
+ uses: actions/setup-java@v2
+ with:
+ distribution: 'temurin'
+ java-version: ${{ matrix.java }}
+ cache: 'maven'
+
+ - name: Install Dependencies
+ run: mvn install -DskipTests=true -Dgpg.skip -Dmaven.javadoc.skip=true -B -V
+
+ - name: Run Unit Tests
+ run: mvn test -B
+
+ deploy:
+ name: Deploy
+ if: success() && github.ref_type == 'tag'
+ needs: [ test ]
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout smtpapi-java
+ uses: actions/checkout@v2
+
+ - name: Set up Sonatype Maven
+ uses: actions/setup-java@v2
+ with:
+ java-version: 8
+ distribution: temurin
+ server-id: ossrh
+ server-username: MAVEN_USERNAME
+ server-password: MAVEN_PASSWORD
+ gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
+ gpg-passphrase: GPG_PASSPHRASE
+
+ - name: Install Dependencies
+ run: make install
+
+ - name: Create GitHub Release
+ uses: sendgrid/dx-automator/actions/release@main
+ with:
+ assets: smtpapi-java.jar
+ footer: '**[Maven](https://mvnrepository.com/artifact/com.sendgrid/smtpapi-java/${version})**'
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Publish to Maven
+ env:
+ MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
+ MAVEN_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
+ GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
+ run: mvn clean deploy -DskipTests=true -B -U -Prelease
+
+ - name: Submit metric to Datadog
+ uses: sendgrid/dx-automator/actions/datadog-release-metric@main
+ env:
+ DD_API_KEY: ${{ secrets.DATADOG_API_KEY }}
+
+ notify-on-failure:
+ name: Slack notify on failure
+ if: failure() && github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || github.ref_type == 'tag')
+ needs: [ test, deploy ]
+ runs-on: ubuntu-latest
+ steps:
+ - uses: rtCamp/action-slack-notify@v2
+ env:
+ SLACK_COLOR: failure
+ SLACK_ICON_EMOJI: ':github:'
+ SLACK_MESSAGE: ${{ format('Test *{0}*, Deploy *{1}*, {2}/{3}/actions/runs/{4}', needs.test.result, needs.deploy.result, github.server_url, github.repository, github.run_id) }}
+ SLACK_TITLE: Action Failure - ${{ github.repository }}
+ SLACK_USERNAME: GitHub Actions
+ SLACK_MSG_AUTHOR: twilio-dx
+ SLACK_FOOTER: Posted automatically using GitHub Actions
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
+ MSG_MINIMAL: true
diff --git a/.github/workflows/update-dependencies.yml b/.github/workflows/update-dependencies.yml
new file mode 100644
index 0000000..8820b34
--- /dev/null
+++ b/.github/workflows/update-dependencies.yml
@@ -0,0 +1,60 @@
+name: Update dependencies
+on:
+ schedule:
+ # Run automatically at 7AM PST Tuesday
+ - cron: '0 14 * * 2'
+ workflow_dispatch:
+
+jobs:
+ update-dependencies-and-test:
+ name: Update Dependencies & Test
+ runs-on: ubuntu-latest
+ timeout-minutes: 20
+ strategy:
+ max-parallel: 1
+ matrix:
+ java: [ 8, 11, 17 ]
+
+ steps:
+ - name: Checkout smtpapi-java
+ uses: actions/checkout@v2
+
+ - name: Set up Java
+ uses: actions/setup-java@v2
+ with:
+ distribution: 'temurin'
+ java-version: ${{ matrix.java }}
+ cache: 'maven'
+
+ - name: Updating semver dependencies
+ run: make update-deps
+
+ - run: mvn install -Dgpg.skip -Dmaven.javadoc.skip=true -B -V
+
+ - name: Add & Commit
+ if: matrix.java == '17'
+ uses: EndBug/add-and-commit@v8.0.2
+ env:
+ GITHUB_TOKEN: ${{ secrets.SG_JAVA_GITHUB_TOKEN }}
+ with:
+ add: 'pom.xml'
+ default_author: 'github_actions'
+ message: 'chore: update smtpapi-java dependencies'
+
+ notify-on-failure:
+ name: Slack notify on failure
+ if: failure()
+ needs: [ update-dependencies-and-test ]
+ runs-on: ubuntu-latest
+ steps:
+ - uses: rtCamp/action-slack-notify@v2
+ env:
+ SLACK_COLOR: failure
+ SLACK_ICON_EMOJI: ':github:'
+ SLACK_MESSAGE: ${{ format('Update dependencies *{0}*, {1}/{2}/actions/runs/{3}', needs.update-dependencies-and-test.result, github.server_url, github.repository, github.run_id) }}
+ SLACK_TITLE: Action Failure - ${{ github.repository }}
+ SLACK_USERNAME: GitHub Actions
+ SLACK_MSG_AUTHOR: twilio-dx
+ SLACK_FOOTER: Posted automatically using GitHub Actions
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
+ MSG_MINIMAL: true
diff --git a/.gitignore b/.gitignore
index eeaed38..5d2f15f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,3 +8,6 @@ out
.DS_Store
gradle.properties
repo
+.env
+target/
+smtpapi-java.jar
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index ea43996..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,25 +0,0 @@
-language: java
-sudo: false
-jdk:
-- oraclejdk8
-- oraclejdk7
-- openjdk7
-after_script:
-- "./gradlew build"
-- "./scripts/s3upload.sh"
-env:
- global:
- - S3_POLICY: ewogICJleHBpcmF0aW9uIjogIjIxMDAtMDEtMDFUMTI6MDA6MDAuMDAwWiIsCiAgImNvbmRpdGlvbnMiOiBbCiAgICB7ImFjbCI6ICJwdWJsaWMtcmVhZCIgfSwKICAgIHsiYnVja2V0IjogInNlbmRncmlkLW9wZW4tc291cmNlIiB9LAogICAgWyJzdGFydHMtd2l0aCIsICIka2V5IiwgInNtdHBhcGktamF2YS8iXSwKICAgIFsiY29udGVudC1sZW5ndGgtcmFuZ2UiLCAyMDQ4LCAyNjg0MzU0NTZdLAogICAgWyJlcSIsICIkQ29udGVudC1UeXBlIiwgImFwcGxpY2F0aW9uL3ppcCJdCiAgXQp9Cg==
- - secure: mmr0NIQtQNnzMXPDN4YRBh8/NZX5FuPYlcrD/iZGMtEYKlXcmKziCzVu/XAvMGYPaeM0TCMSreWX2cD6KfFfcXQOtEoQGjngqHYWYjO9H3FwkUKJhjAEPqkAiI/kc5A9RMoM66eQvEcQ03mwyrXz3Xsuy826mKBUyMBcIvX0D/I=
- - secure: aqXQn+NgNXEXL1GgzZP2+pqr0SVffAo6UZs4Tdu1l3eOVUhddAXpM3wZDqQpOMF1UfVCyIOymYTertVwFg9STMnnJHVy/lcRkG2E1w0bcs2S/goZtWGpr94EvIhm3ESw0rszkZLKgvbDnGQRd5/rqgRAqNq/aJnPnmocP+YfsQ0=
- - secure: Z0ivY2rTHZaD/30+2Ta4UrFIjSro6epw+w3Ufu74YzTT3UcTIIb8zhNoMlcwZjTEtJu1IkDQljR3kYg3/1Gx3qZUwo98eq7TVVh+ozzQTcWu8lKz4+vIduS04mZTAZgEDuntkP86yGOfeRRezlG9LYuWmiQfMlOR4wZvjfYjPAk=
-notifications:
- hipchat:
- rooms:
- secure: ko9f34ZvoDhf685wpxViPnWuNzaUYcQ3CBwdIsYWzGASMtdRY9X9pJWGwo/IfZIYoxrOFtCRWQEl9O0vq/DglB7T/uXsTyCvJurVg2d/Q5JLEgG1LQnW2vQGEeLbahiW9F/IT3htsfs+ZXRavKM2Bbokx1f9CLokehL+p0Z9xus=
- template:
- - '%{repository}
- Build %{build_number} on branch %{branch} by %{author}: %{message}
- View on GitHub'
- format: html
- notify: true
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 47e65b7..bdbaee3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,7 +1,138 @@
# Change Log
All notable changes to this project will be documented in this file.
-## [1.2.0] - 2015-5-14
+[2024-06-06] Version 1.3.3
+--------------------------
+**Library - Chore**
+- [PR #125](https://github.com/sendgrid/smtpapi-java/pull/125): added Maven badge. Thanks to [@tiwarishubham635](https://github.com/tiwarishubham635)!
+
+
+[2024-04-18] Version 1.3.2
+--------------------------
+**Library - Chore**
+- [PR #124](https://github.com/sendgrid/smtpapi-java/pull/124): Update LICENSE year. Thanks to [@tiwarishubham635](https://github.com/tiwarishubham635)!
+- [PR #123](https://github.com/sendgrid/smtpapi-java/pull/123): bump org.json:json from 20140107 to 20231013. Thanks to [@dependabot](https://github.com/dependabot)!
+
+**Library - Test**
+- [PR #119](https://github.com/sendgrid/smtpapi-java/pull/119): Adding misc as PR type. Thanks to [@rakatyal](https://github.com/rakatyal)!
+
+
+[2022-05-18] Version 1.3.1
+--------------------------
+**Library - Docs**
+- [PR #118](https://github.com/sendgrid/smtpapi-java/pull/118): Modify Docs to align with SendGrid Support. Thanks to [@garethpaul](https://github.com/garethpaul)!
+
+**Library - Fix**
+- [PR #117](https://github.com/sendgrid/smtpapi-java/pull/117): override default gh token. Thanks to [@beebzz](https://github.com/beebzz)!
+
+
+[2022-03-09] Version 1.3.0
+--------------------------
+**Library - Chore**
+- [PR #116](https://github.com/sendgrid/smtpapi-java/pull/116): push Datadog Release Metric upon deploy success. Thanks to [@eshanholtz](https://github.com/eshanholtz)!
+
+**Library - Feature**
+- [PR #115](https://github.com/sendgrid/smtpapi-java/pull/115): add GH action to update dependencies. Thanks to [@JenniferMah](https://github.com/JenniferMah)!
+
+
+[2022-02-09] Version 1.2.10
+---------------------------
+**Library - Chore**
+- [PR #114](https://github.com/sendgrid/smtpapi-java/pull/114): upgrade supported language versions. Thanks to [@childish-sambino](https://github.com/childish-sambino)!
+- [PR #113](https://github.com/sendgrid/smtpapi-java/pull/113): add gh release to workflow. Thanks to [@shwetha-manvinkurke](https://github.com/shwetha-manvinkurke)!
+- [PR #112](https://github.com/sendgrid/smtpapi-java/pull/112): merge test and release workflows. Thanks to [@Hunga1](https://github.com/Hunga1)!
+
+
+[2022-01-12] Version 1.2.9
+--------------------------
+**Library - Chore**
+- [PR #111](https://github.com/sendgrid/smtpapi-java/pull/111): update license year. Thanks to [@JenniferMah](https://github.com/JenniferMah)!
+
+
+[2021-12-01] Version 1.2.8
+--------------------------
+**Library - Chore**
+- [PR #110](https://github.com/sendgrid/smtpapi-java/pull/110): fix pom for release. Thanks to [@eshanholtz](https://github.com/eshanholtz)!
+- [PR #109](https://github.com/sendgrid/smtpapi-java/pull/109): migrate to github actions. Thanks to [@eshanholtz](https://github.com/eshanholtz)!
+
+
+[2020-12-02] Version 1.2.7
+--------------------------
+**Library - Chore**
+- [PR #70](https://github.com/sendgrid/smtpapi-java/pull/70): Update SMTPAPI.java. Thanks to [@gargi-gupta](https://github.com/gargi-gupta)!
+
+
+[2020-08-19] Version 1.2.6
+--------------------------
+**Library - Docs**
+- [PR #85](https://github.com/sendgrid/smtpapi-java/pull/85): ran grammarly checks through all the *.md docs. Thanks to [@aquibbaig](https://github.com/aquibbaig)!
+
+**Library - Chore**
+- [PR #108](https://github.com/sendgrid/smtpapi-java/pull/108): update GitHub branch references to use HEAD. Thanks to [@thinkingserious](https://github.com/thinkingserious)!
+
+
+[2020-08-05] Version 1.2.5
+--------------------------
+**Library - Test**
+- [PR #62](https://github.com/sendgrid/smtpapi-java/pull/62): Add CodeCov support to travis. Thanks to [@pushkyn](https://github.com/pushkyn)!
+
+
+[2020-03-04] Version 1.2.4
+--------------------------
+**Library - Chore**
+- [PR #107](https://github.com/sendgrid/smtpapi-java/pull/107): fix JDK Travis failures. Thanks to [@childish-sambino](https://github.com/childish-sambino)!
+
+
+[2020-02-19] Version 1.2.3
+--------------------------
+**Library - Docs**
+- [PR #76](https://github.com/sendgrid/smtpapi-java/pull/76): Added Code Review to Contributing.md. Thanks to [@mptap](https://github.com/mptap)!
+
+**Library - Fix**
+- [PR #105](https://github.com/sendgrid/smtpapi-java/pull/105): release instructions. Thanks to [@eshanholtz](https://github.com/eshanholtz)!
+
+
+[2020-02-05] Version 1.2.2
+--------------------------
+**Library - Docs**
+- [PR #106](https://github.com/sendgrid/smtpapi-java/pull/106): baseline all the templated markdown docs. Thanks to [@childish-sambino](https://github.com/childish-sambino)!
+
+
+[2020-02-01] Version 1.2.1
+--------------------------
+**Library - Docs**
+- [PR #17](https://github.com/sendgrid/smtpapi-java/pull/17): Minor spelling errors. Thanks to [@graph1994](https://github.com/graph1994)!
+- [PR #18](https://github.com/sendgrid/smtpapi-java/pull/18): Update README.md. Thanks to [@ciceropablo](https://github.com/ciceropablo)!
+- [PR #25](https://github.com/sendgrid/smtpapi-java/pull/25): SEO friendly links for README.md and CONTRIBUTING.md. Thanks to [@whitneyrosenberg](https://github.com/whitneyrosenberg)!
+- [PR #26](https://github.com/sendgrid/smtpapi-java/pull/26): Add/Update Badges on README. Thanks to [@mptap](https://github.com/mptap)!
+- [PR #27](https://github.com/sendgrid/smtpapi-java/pull/27): Demonstrate how to review the request body for troubleshooting. Thanks to [@mptap](https://github.com/mptap)!
+- [PR #28](https://github.com/sendgrid/smtpapi-java/pull/28): add table of contents in README.md. Thanks to [@thepriefy](https://github.com/thepriefy)!
+- [PR #29](https://github.com/sendgrid/smtpapi-java/pull/29): update readme - logo on separate line. Thanks to [@pushkyn](https://github.com/pushkyn)!
+- [PR #30](https://github.com/sendgrid/smtpapi-java/pull/30): update contributing.md - fix typo. Thanks to [@pushkyn](https://github.com/pushkyn)!
+- [PR #33](https://github.com/sendgrid/smtpapi-java/pull/33): add github PR template. Thanks to [@pushkyn](https://github.com/pushkyn)!
+- [PR #40](https://github.com/sendgrid/smtpapi-java/pull/40): update README.md. Thanks to [@thepriefy](https://github.com/thepriefy)!
+- [PR #41](https://github.com/sendgrid/smtpapi-java/pull/41): Added TROUBLESHOOTING.md. Thanks to [@mptap](https://github.com/mptap)!
+- [PR #99](https://github.com/sendgrid/smtpapi-java/pull/99): Added Announcement. Thanks to [@luciajimenez](https://github.com/luciajimenez)!
+
+**Library - Chore**
+- [PR #19](https://github.com/sendgrid/smtpapi-java/pull/19): Update .travis.yml. Thanks to [@ciceropablo](https://github.com/ciceropablo)!
+- [PR #21](https://github.com/sendgrid/smtpapi-java/pull/21): Added Code of Conduct. Thanks to [@gr8shivam](https://github.com/gr8shivam)!
+- [PR #31](https://github.com/sendgrid/smtpapi-java/pull/31): add .github/ISSUE_TEMPLATE. Thanks to [@thepriefy](https://github.com/thepriefy)!
+- [PR #39](https://github.com/sendgrid/smtpapi-java/pull/39): Add a .env_sample file. Thanks to [@thepriefy](https://github.com/thepriefy)!
+- [PR #44](https://github.com/sendgrid/smtpapi-java/pull/44): Update CONTRIBUTING.md. Thanks to [@rkaranam](https://github.com/rkaranam)!
+- [PR #48](https://github.com/sendgrid/smtpapi-java/pull/48): update LICENSE - fix year. Thanks to [@pushkyn](https://github.com/pushkyn)!
+- [PR #103](https://github.com/sendgrid/smtpapi-java/pull/103): prep the repo for automated releasing. Thanks to [@eshanholtz](https://github.com/eshanholtz)!
+
+**Library - Fix**
+- [PR #43](https://github.com/sendgrid/smtpapi-java/pull/43): Add .codeclimate.yml file. Thanks to [@rzats](https://github.com/rzats)!
+
+**Library - Test**
+- [PR #49](https://github.com/sendgrid/smtpapi-java/pull/49): Add tests for Project files. Thanks to [@pjhampton](https://github.com/pjhampton)!
+- [PR #50](https://github.com/sendgrid/smtpapi-java/pull/50): Add Unit Test to verify LICENSE file date range. Thanks to [@joe94](https://github.com/joe94)!
+
+
+[2015-05-14] Version 1.2.0
+---------------------------
### Added
- Support for raw unescaped JSON string - via [#10](https://github.com/sendgrid/smtpapi-java/pull/10)
- Version sanity tests
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
new file mode 100644
index 0000000..2f0727e
--- /dev/null
+++ b/CODE_OF_CONDUCT.md
@@ -0,0 +1,73 @@
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+In the interest of fostering an open and welcoming environment, we as
+contributors and maintainers pledge to making participation in our project and
+our community a harassment-free experience for everyone, regardless of age, body
+size, disability, ethnicity, sex characteristics, gender identity and expression,
+level of experience, education, socio-economic status, nationality, personal
+appearance, race, religion, or sexual identity and orientation.
+
+## Our Standards
+
+Examples of behavior that contributes to creating a positive environment
+include:
+
+- Using welcoming and inclusive language
+- Being respectful of differing viewpoints and experiences
+- Gracefully accepting constructive criticism
+- Focusing on what is best for the community
+- Showing empathy towards other community members
+
+Examples of unacceptable behavior by participants include:
+
+- The use of sexualized language or imagery and unwelcome sexual attention or
+ advances
+- Trolling, insulting/derogatory comments, and personal or political attacks
+- Public or private harassment
+- Publishing others' private information, such as a physical or electronic
+ address, without explicit permission
+- Other conduct which could reasonably be considered inappropriate in a
+ professional setting
+
+## Our Responsibilities
+
+Project maintainers are responsible for clarifying the standards of acceptable
+behavior and are expected to take appropriate and fair corrective action in
+response to any instances of unacceptable behavior.
+
+Project maintainers have the right and responsibility to remove, edit, or
+reject comments, commits, code, wiki edits, issues, and other contributions
+that are not aligned to this Code of Conduct, or to ban temporarily or
+permanently any contributor for other behaviors that they deem inappropriate,
+threatening, offensive, or harmful.
+
+## Scope
+
+This Code of Conduct applies both within project spaces and in public spaces
+when an individual is representing the project or its community. Examples of
+representing a project or community include using an official project e-mail
+address, posting via an official social media account, or acting as an appointed
+representative at an online or offline event. Representation of a project may be
+further defined and clarified by project maintainers.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be
+reported by contacting the project team at open-source@twilio.com. All
+complaints will be reviewed and investigated and will result in a response that
+is deemed necessary and appropriate to the circumstances. The project team is
+obligated to maintain confidentiality with regard to the reporter of an incident.
+Further details of specific enforcement policies may be posted separately.
+
+Project maintainers who do not follow or enforce the Code of Conduct in good
+faith may face temporary or permanent repercussions as determined by other
+members of the project's leadership.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
+available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
+
+[homepage]: https://www.contributor-covenant.org
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index de43f60..1ab0f1f 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,59 +1,13 @@
Hello! Thank you for choosing to help contribute to one of the SendGrid open source libraries. There are many ways you can contribute and help is always welcome. We simply ask that you follow the following contribution policies.
-- [CLAs and CCLAs](#cla)
-- [Roadmap & Milestones](#roadmap)
-- [Feature Request](#feature_request)
-- [Submit a Bug Report](#submit_a_bug_report)
-- [Improvements to the Codebase](#improvements_to_the_codebase)
-- [Understanding the Code Base](#understanding_the_codebase)
+- [Improvements to the Codebase](#improvements-to-the-codebase)
+- [Understanding the Code Base](#understanding-the-codebase)
- [Testing](#testing)
- [Style Guidelines & Naming Conventions](#style_guidelines_and_naming_conventions)
- [Creating a Pull Request](#creating_a_pull_request)
+- [Code Reviews](#code-reviews)
-
-We use [Milestones](https://github.com/sendgrid/smtpapi-java/milestones) to help define current roadmaps, please feel free to grab an issue from the current milestone. Please indicate that you have begun work on it to avoid collisions. Once a PR is made, community review, comments, suggestions and additional PRs are welcomed and encouraged.
-
-
-## CLAs and CCLAs
-
-Before you get started, SendGrid requires that a SendGrid Contributor License Agreement (CLA) be filled out by every contributor to a SendGrid open source project.
-
-Our goal with the CLA is to clarify the rights of our contributors and reduce other risks arising from inappropriate contributions. The CLA also clarifies the rights SendGrid holds in each contribution and helps to avoid misunderstandings over what rights each contributor is required to grant to SendGrid when making a contribution. In this way the CLA encourages broad participation by our open source community and helps us build strong open source projects, free from any individual contributor withholding or revoking rights to any contribution.
-
-SendGrid does not merge a pull request made against a SendGrid open source project until that pull request is associated with a signed CLA. Copies of the CLA are available [here](https://gist.github.com/SendGridDX/98b42c0a5d500058357b80278fde3be8#file-sendgrid_cla).
-
-When you create a Pull Request, after a few seconds, a comment will appear with a link to the CLA. Click the link and fill out the brief form and then click the "I agree" button and you are all set. You will not be asked to re-sign the CLA unless we make a change.
-
-There are a few ways to contribute, which we'll enumerate below:
-
-
-## Feature Request
-
-If you'd like to make a feature request, please read this section.
-
-The GitHub issue tracker is the preferred channel for library feature requests, but please respect the following restrictions:
-
-- Please **search for existing issues** in order to ensure we don't have duplicate bugs/feature requests.
-- Please be respectful and considerate of others when commenting on issues
-
-
-## Submit a Bug Report
-
-Note: DO NOT include your credentials in ANY code examples, descriptions, or media you make public.
-
-A software bug is a demonstrable issue in the code base. In order for us to diagnose the issue and respond as quickly as possible, please add as much detail as possible into your bug report.
-
-Before you decide to create a new issue, please try the following:
-
-1. Check the Github issues tab if the identified issue has already been reported, if so, please add a +1 to the existing post.
-2. Update to the latest version of this code and check if issue has already been fixed
-3. Copy and fill in the Bug Report Template we have provided below
-
-### Please use our Bug Report Template
-
-In order to make the process easier, we've included a [sample bug report template](https://github.com/sendgrid/smtpapi-java/.github/ISSUE_TEMPLATE) (borrowed from [Ghost](https://github.com/TryGhost/Ghost/)). The template uses [GitHub flavored markdown](https://help.github.com/articles/github-flavored-markdown/) for formatting.
-
-
+
## Improvements to the Codebase
We welcome direct contributions to the smtpapi-java code base. Thank you!
@@ -64,8 +18,8 @@ We welcome direct contributions to the smtpapi-java code base. Thank you!
##### Prerequisites #####
-- Java version Oracle JDK 7, 8 or OpenJDK 7
-- See [build.gradle](https://github.com/sendgrid/smtpapi-java/blob/master/build.gradle) for dependencies.
+- Java 8 or 11
+- See [pom.xml](pom.xml) for dependencies.
##### Initial setup: #####
@@ -77,14 +31,14 @@ cd smtpapi-java
##### Execute: #####
-See the [examples folder](https://github.com/sendgrid/smtpapi-java/tree/master/examples) to get started quickly.
+See the [examples folder](examples) to get started quickly.
```bash
cd examples
javac -classpath ../repo/com/sendgrid/smtpapi-jar.jar:. Example.java && java -classpath ../repo/com/sendgrid/smtpapi-jar.jar:. Example
```
-
+
## Understanding the Code Base
**/examples**
@@ -104,9 +58,9 @@ Source code.
All PRs require passing tests before the PR will be reviewed.
-All test files are in the [`/src/test/java/com/sendgrid/smtpapi/`](https://github.com/sendgrid/smtpapi-java/tree/master/src/test/java/com/sendgrid/smtpapi/) directory.
+All test files are in the [`/src/test/java/com/sendgrid/smtpapi/`](src/test/java/com/sendgrid/smtpapi/) directory.
-For the purposes of contributing to this repo, please update the [`SMTPAPITest.java`](https://github.com/sendgrid/smtpapi-java/blob/master/test/src/test/java/com/sendgrid/smtpapi/SMTPAPITest.java) file with unit tests as you modify the code.
+For the purposes of contributing to this repo, please update the [`SMTPAPITest.java`](src/test/java/com/sendgrid/smtpapi/SMTPAPITest.java) file with unit tests as you modify the code.
To run the tests:
@@ -114,7 +68,7 @@ To run the tests:
./gradlew check
```
-
+
## Style Guidelines & Naming Conventions
Generally, we follow the style guidelines as suggested by the official language. However, we ask that you conform to the styles that already exist in the library. If you wish to deviate, please explain your reasoning.
@@ -124,7 +78,7 @@ Please run your code through:
- [FindBugs](http://findbugs.sourceforge.net/)
- [CheckStyle](http://checkstyle.sourceforge.net/) with [Google's Java Style Guide](http://checkstyle.sourceforge.net/reports/google-java-style.html).
-## Creating a Pull Request
+## Creating a Pull Request
1. [Fork](https://help.github.com/fork-a-repo/) the project, clone your fork,
and configure the remotes:
@@ -133,7 +87,7 @@ Please run your code through:
# Clone your fork of the repo into the current directory
git clone https://github.com/sendgrid/smtpapi-java
# Navigate to the newly cloned directory
- cd sendgrid-python
+ cd smtpapi-java
# Assign the original repo to a remote called "upstream"
git remote add upstream https://github.com/sendgrid/smtpapi-java
```
@@ -165,7 +119,7 @@ Please run your code through:
5. Locally merge (or rebase) the upstream development branch into your topic branch:
```bash
- git pull [--rebase] upstream master
+ git pull [--rebase] upstream main
```
6. Push your topic branch up to your fork:
@@ -175,6 +129,9 @@ Please run your code through:
```
7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/)
- with a clear title and description against the `master` branch. All tests must be passing before we will review the PR.
+ with a clear title and description against the `main` branch. All tests must be passing before we will review the PR.
+
+
+## Code Reviews
-If you have any additional questions, please feel free to [email](mailto:dx@sendgrid.com) us or create an issue in this repo.
+If you can, please look at open PRs and review them. Give feedback and help us merge these PRs much faster! If you don't know how, Github has some [great information on how to review a Pull Request](https://help.github.com/articles/about-pull-request-reviews/).
diff --git a/FIRST_TIMERS.md b/FIRST_TIMERS.md
new file mode 100644
index 0000000..915ef4f
--- /dev/null
+++ b/FIRST_TIMERS.md
@@ -0,0 +1,53 @@
+# How To Contribute to Twilio SendGrid Repositories via GitHub
+Contributing to the Twilio SendGrid repositories is easy! All you need to do is find an open issue (see the bottom of this page for a list of repositories containing open issues), fix it and submit a pull request. Once you have submitted your pull request, the team can easily review it before it is merged into the repository.
+
+To make a pull request, follow these steps:
+
+1. Log into GitHub. If you do not already have a GitHub account, you will have to create one in order to submit a change. Click the Sign up link in the upper right-hand corner to create an account. Enter your username, password, and email address. If you are an employee of Twilio SendGrid, please use your full name with your GitHub account and enter Twilio SendGrid as your company so we can easily identify you.
+
+
+
+2. __[Fork](https://help.github.com/fork-a-repo/)__ the [smtpapi-java](https://github.com/sendgrid/smtpapi-java) repository:
+
+
+
+3. __Clone__ your fork via the following commands:
+
+```bash
+# Clone your fork of the repo into the current directory
+git clone https://github.com/your_username/smtpapi-java
+# Navigate to the newly cloned directory
+cd smtpapi-java
+# Assign the original repo to a remote called "upstream"
+git remote add upstream https://github.com/sendgrid/smtpapi-java
+```
+
+> Don't forget to replace *your_username* in the URL by your real GitHub username.
+
+4. __Create a new topic branch__ (off the main project development branch) to contain your feature, change, or fix:
+
+```bash
+git checkout -b
+```
+
+5. __Commit your changes__ in logical chunks.
+
+Please adhere to these [git commit message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) or your code is unlikely be merged into the main project. Use Git's [interactive rebase](https://help.github.com/articles/interactive-rebase) feature to tidy up your commits before making them public. Probably you will also have to create tests (if needed) or create or update the example code that demonstrates the functionality of this change to the code.
+
+6. __Locally merge (or rebase)__ the upstream development branch into your topic branch:
+
+```bash
+git pull [--rebase] upstream main
+```
+
+7. __Push__ your topic branch up to your fork:
+
+```bash
+git push origin
+```
+
+8. __[Open a Pull Request](https://help.github.com/articles/creating-a-pull-request/#changing-the-branch-range-and-destination-repository/)__ with a clear title and description against the `main` branch. All tests must be passing before we will review the PR.
+
+## Important notice
+
+Before creating a pull request, make sure that you respect the repository's constraints regarding contributions. You can find them in the [CONTRIBUTING.md](CONTRIBUTING.md) file.
diff --git a/LICENSE.txt b/LICENSE
similarity index 59%
rename from LICENSE.txt
rename to LICENSE
index 210bde8..d703157 100644
--- a/LICENSE.txt
+++ b/LICENSE
@@ -1,13 +1,13 @@
-The MIT License (MIT)
+MIT License
-Copyright (c) 2014-2016 SendGrid, Inc.
+Copyright (C) 2024, Twilio SendGrid, Inc.
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..4dec826
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,20 @@
+.PHONY: install package test update-deps clean
+
+VERSION := $(shell mvn help:evaluate -Dexpression=project.version --batch-mode | grep -e '^[^\[]')
+install:
+ @java -version || (echo "Java is not installed, please install Java >= 7"; exit 1);
+ mvn clean install -DskipTests=true -Dgpg.skip -B
+ cp target/smtpapi-java-$(VERSION).jar smtpapi-java.jar
+
+package:
+ mvn package -DskipTests=true -Dgpg.skip -B
+ cp target/smtpapi-java-$(VERSION).jar smtpapi-java.jar
+
+test:
+ mvn test
+
+update-deps:
+ mvn versions:use-latest-releases versions:commit -DallowMajorUpdates=false
+
+clean:
+ mvn clean
diff --git a/PULL_REQUEST_TEMPLATE.md b/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 0000000..fad5665
--- /dev/null
+++ b/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,31 @@
+
+
+# Fixes #
+
+A short description of what this PR does.
+
+### Checklist
+- [x] I acknowledge that all my contributions will be made under the project's license
+- [ ] I have made a material change to the repo (functionality, testing, spelling, grammar)
+- [ ] I have read the [Contribution Guidelines](https://github.com/sendgrid/smtpapi-java/blob/main/CONTRIBUTING.md) and my PR follows them
+- [ ] I have titled the PR appropriately
+- [ ] I have updated my branch with the main branch
+- [ ] I have added tests that prove my fix is effective or that my feature works
+- [ ] I have added the necessary documentation about the functionality in the appropriate .md file
+- [ ] I have added inline documentation to the code I modified
+
+If you have questions, please file a [support ticket](https://support.sendgrid.com).
diff --git a/README.md b/README.md
index 7aaf590..55a7c4d 100644
--- a/README.md
+++ b/README.md
@@ -1,16 +1,31 @@
-[](https://travis-ci.org/sendgrid/smtpapi-java)
+
+
+[](https://github.com/sendgrid/smtpapi-java/actions/workflows/test-and-deploy.yml)
+[](http://mvnrepository.com/artifact/com.sendgrid/smtpapi-java)
+[](https://twitter.com/sendgrid)
+[](https://github.com/sendgrid/smtpapi-java/graphs/contributors)
+[](LICENSE)
**This module allows you to build SendGrid's SMTP API headers with simplicity.**
# Announcements
-
-All updates to this module is documented in our [CHANGELOG](https://github.com/sendgrid/smtpapi-java/blob/master/CHANGELOG.md).
-
+All updates to this module are documented in our [CHANGELOG](CHANGELOG.md).
+
+# Table of Contents
+- [Installation](#installation)
+- [Quick Start](#quick-start)
+- [Usage](#usage)
+- [How to Contribute](#contribute)
+- [About](#about)
+- [Support](#support)
+- [License](#license)
+
+
# Installation
## Prerequisites
-- Java version Oracle JDK 7, 8 or OpenJDK 7
+- Java 8, 11, or 17
- The SendGrid service, starting at the [free level](https://sendgrid.com/free?source=smtpapi-java)
## Install Package
@@ -23,7 +38,7 @@ Choose your installation method - Maven w/ Gradle (recommended) or Jar file.
...
dependencies {
...
- compile 'com.sendgrid:smtpapi-java:1.2.0'
+ compile 'com.sendgrid:smtpapi-java:1.3.3'
}
repositories {
@@ -38,16 +53,28 @@ Then import the library - in the file appropriate to your Java project.
import com.sendgrid.smtpapi.SMTPAPI;
```
-### Insatll with Jar File
+### Install with Jar File
You can just drop the jar file in. It's a fat jar - it has all the dependencies built in.
[smtpapi-java.jar](https://sendgrid-open-source.s3.amazonaws.com/smtpapi-java/smtpapi-java.jar)
+
+## Environment Variable
+
+Update the development environment with your [SENDGRID_API_KEY](https://app.sendgrid.com/settings/api_keys), for example:
+
+```bash
+echo "export SENDGRID_API_KEY='YOUR_API_KEY'" > sendgrid.env
+echo "sendgrid.env" >> .gitignore
+source ./sendgrid.env
+```
+
## Dependencies
-- See [build.gradle](https://github.com/sendgrid/smtpapi-java/blob/master/build.gradle#L47).
+- See [pom.xml](pom.xml).
+
# Quick Start
```java
@@ -63,31 +90,34 @@ public class Example {
}
```
+
# Usage
- [SendGrid Docs](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html)
-- [Example Code](https://github.com/sendgrid/smtpapi-java/tree/master/examples)
-
-## Roadmap
+- [Example Code](examples)
-If you are intersted in the future direction of this project, please take a look at our [milestones](https://github.com/sendgrid/smtpapi-java/milestones). We would love to hear your feedback.
+
+# How to Contribute
-## How to Contribute
-
-We encourage contribution to our projects, please see our [CONTRIBUTING](https://github.com/sendgrid/smtpapi-java/blob/master/CONTRIBUTING.md) guide for details.
+We encourage contribution to our projects, please see our [CONTRIBUTING](CONTRIBUTING.md) guide for details.
Quick links:
-- [Feature Request](https://github.com/sendgrid/smtpapi-java/blob/master/CONTRIBUTING.md#feature_request)
-- [Bug Reports](https://github.com/sendgrid/smtpapi-java/blob/master/CONTRIBUTING.md#submit_a_bug_report)
-- [Sign the CLA to Create a Pull Request](https://github.com/sendgrid/smtpapi-java/blob/master/CONTRIBUTING.md#cla)
-- [Improvements to the Codebase](https://github.com/sendgrid/smtpapi-java/blob/master/CONTRIBUTING.md#improvements_to_the_codebase)
+- [Feature Request](CONTRIBUTING.md#feature-request)
+- [Bug Reports](CONTRIBUTING.md#submit-a-bug-report)
+- [Improvements to the Codebase](CONTRIBUTING.md#improvements_to_the_codebase)
+- [Review Pull Requests](CONTRIBUTING.md#code-reviews)
+
# About
-smtpapi-java is guided and supported by the SendGrid [Developer Experience Team](mailto:dx@sendgrid.com).
+smtpapi-java is maintained and funded by Twilio SendGrid, Inc. The names and logos for smtpapi-java are trademarks of Twilio SendGrid, Inc.
+
+
+# Support
-smtpapi-java is maintained and funded by SendGrid, Inc. The names and logos for smtpapi-java are trademarks of SendGrid, Inc.
+If you need help using SendGrid, please check the [Twilio SendGrid Support Help Center](https://support.sendgrid.com).
-![SendGrid Logo]
-(https://uiux.s3.amazonaws.com/2016-logos/email-logo%402x.png)
+
+# License
+[The MIT License (MIT)](LICENSE)
diff --git a/TROUBLESHOOTING.md b/TROUBLESHOOTING.md
new file mode 100644
index 0000000..9cb8d7f
--- /dev/null
+++ b/TROUBLESHOOTING.md
@@ -0,0 +1,16 @@
+If you have a SendGrid issue, please contact our [support team](https://support.sendgrid.com).
+
+## Table of Contents
+
+* [Viewing the Request Body](#request-body)
+
+
+## Viewing the Request Body
+
+When debugging or testing, it may be useful to examine the raw request body to compare against the [documented format](https://sendgrid.com/docs/API_Reference/api_v3.html).
+
+You can do this right before you call `request.setBody(mail.build())` like so:
+
+```java
+System.out.println(mail.build());
+```
diff --git a/build.gradle b/build.gradle
deleted file mode 100644
index 7ef87ee..0000000
--- a/build.gradle
+++ /dev/null
@@ -1,159 +0,0 @@
-/**
- * Commands:
- * - gradle build
- * - gradle test
- * - gradle assemble
- * - gradle uploadArchives
- *
- * To execute the 'uploadArchives' task, the following properties must be specified
- * in an external 'gradle.properties' file:
- * - sonatypeUsername
- * - sonatypePassword
- */
-
-apply plugin: 'java'
-apply plugin: 'fatjar'
-apply plugin: 'maven'
-apply plugin: 'signing'
-
-allprojects {
- apply plugin: 'java'
- sourceCompatibility = 1.6
- targetCompatibility = 1.6
-}
-
-group = 'com.sendgrid'
-version = '1.2.0'
-ext.packaging = 'jar'
-
-if (!hasProperty("sonatypeUsername")) {
- ext.sonatypeUsername = null
- ext.sonatypePassword = null
-}
-
-task wrapper(type: Wrapper) {
- gradleVersion = '1.8'
-}
-
-buildscript {
- dependencies {
- classpath 'eu.appsatori:gradle-fatjar-plugin:0.1.2' // adds fatJar task
- }
- repositories {
- mavenCentral()
- }
-}
-
-dependencies {
- compile 'org.json:json:20140107'
- testCompile group:'org.skyscreamer', name:'jsonassert', version:'1.2.3'
- testCompile group:'junit', name:'junit', version:'4.12'
-}
-
-repositories {
- mavenCentral()
-}
-
-allprojects {
- gradle.projectsEvaluated {
- tasks.withType(JavaCompile) {
- options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
- }
- }
-}
-
-// adds 'with-dependencies' to the fatJar name
-fatJar {
- classifier 'jar'
- baseName "smtpapi"
- manifest {
- attributes("Implementation-Title": "SMTPAPI", "Implementation-Version": version)
- }
-}
-
-// copy fatJar to base project directory so they will be in git (and on github for download)
-build << {
- copy {
- println "Copying ${fatJar.archiveName} to $projectDir/repo/com/sendgrid/$version"
- from("$buildDir/libs/${fatJar.archiveName}")
- into("$projectDir/repo/com/sendgrid/$version")
- }
- copy {
- println "Copying ${fatJar.archiveName} to $projectDir/repo/com/sendgrid"
- from("$buildDir/libs/${fatJar.archiveName}")
- into("$projectDir/repo/com/sendgrid")
- }
- tasks.renameSmtpapiVersionJarToSmtpapiJar.execute()
-}
-
-task renameSmtpapiVersionJarToSmtpapiJar {
- doLast {
- file("$projectDir/repo/com/sendgrid/${fatJar.archiveName}").renameTo(file("$projectDir/repo/com/sendgrid/smtpapi-jar.jar"))
- }
-}
-
-task javadocJar(type: Jar, dependsOn: javadoc) {
- classifier = 'javadoc'
- from 'build/docs/javadoc'
-}
-
-task sourcesJar(type: Jar) {
- from sourceSets.main.allSource
- classifier = 'sources'
-}
-
-signing {
- required { gradle.taskGraph.hasTask("uploadArchives") }
- sign configurations.archives
-}
-
-uploadArchives {
- repositories {
- mavenDeployer {
- beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
- repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
- authentication(userName: sonatypeUsername, password: sonatypePassword)
- }
-
- pom.project {
- name 'smtpapi-java'
- packaging 'jar'
- description 'SMTPAPI Java helper library'
- url 'https://github.com/sendgrid/smtpapi-java'
-
- scm {
- url 'scm:git@github.com:sendgrid/smtpapi-java.git'
- connection 'scm:git@github.com:sendgrid/smtpapi-java.git'
- developerConnection 'scm:git@github.com:sendgrid/smtpapi-java.git'
- }
-
- licenses {
- license {
- name 'MIT License'
- url 'http://opensource.org/licenses/MIT'
- distribution 'repo'
- }
- }
-
- developers {
- developer {
- id 'scottmotte'
- name 'Scott Motte'
- }
- developer {
- id 'elbuo8'
- name 'Yamil Asusta'
- }
- }
- }
- }
- }
-}
-
-artifacts {
- archives fatJar
-
- archives jar
- archives javadocJar
- archives sourcesJar
-}
diff --git a/gradle.properties.example b/gradle.properties.example
deleted file mode 100644
index cde593e..0000000
--- a/gradle.properties.example
+++ /dev/null
@@ -1,6 +0,0 @@
-signing.keyId=
-signing.password=
-signing.secretKeyRingFile=/Users/yourusername/.gnupg/secring.gpg
-
-sonatypeUsername=
-sonatypePassword=
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
deleted file mode 100644
index 0087cd3..0000000
Binary files a/gradle/wrapper/gradle-wrapper.jar and /dev/null differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
deleted file mode 100644
index 2bd1e69..0000000
--- a/gradle/wrapper/gradle-wrapper.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-#Thu May 22 15:47:34 PDT 2014
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-1.8-bin.zip
diff --git a/gradlew b/gradlew
deleted file mode 100755
index 91a7e26..0000000
--- a/gradlew
+++ /dev/null
@@ -1,164 +0,0 @@
-#!/usr/bin/env bash
-
-##############################################################################
-##
-## Gradle start up script for UN*X
-##
-##############################################################################
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn ( ) {
- echo "$*"
-}
-
-die ( ) {
- echo
- echo "$*"
- echo
- exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
-esac
-
-# For Cygwin, ensure paths are in UNIX format before anything is touched.
-if $cygwin ; then
- [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
-fi
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >&-
-APP_HOME="`pwd -P`"
-cd "$SAVED" >&-
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-
-# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- if [ ! -x "$JAVACMD" ] ; then
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
- fi
-else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-fi
-
-# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
- fi
- i=$((i+1))
- done
- case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
-fi
-
-# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
-function splitJvmOpts() {
- JVM_OPTS=("$@")
-}
-eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
-JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
-
-exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/gradlew.bat b/gradlew.bat
deleted file mode 100644
index aec9973..0000000
--- a/gradlew.bat
+++ /dev/null
@@ -1,90 +0,0 @@
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..0edaa44
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,220 @@
+
+
+ 4.0.0
+
+ org.sonatype.oss
+ oss-parent
+ 7
+
+ com.sendgrid
+ smtpapi-java
+ jar
+ SMTPAPI Java
+ SMTPAPI Java helper library
+ 1.3.3
+ https://github.com/sendgrid/smtapi-java
+
+
+ The MIT License (MIT)
+ https://github.com/sendgrid/smtpapi-java/blob/HEAD/LICENSE
+ repo
+
+
+
+ scm:git@github.com:sendgrid/smtpapi-java.git
+ scm:git@github.com:sendgrid/smtpapi-java.git
+ scm:git@github.com:sendgrid/smtpapi-java.git
+ 1.3.3
+
+
+
+ release
+
+
+ release
+
+
+
+
+
+ org.sonatype.plugins
+ nexus-staging-maven-plugin
+ 1.6.8
+ true
+
+ ossrh
+ https://oss.sonatype.org/
+ true
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+ 3.0.1
+
+
+ attach-sources
+
+ jar-no-fork
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ 2.10.4
+
+
+ attach-javadocs
+
+ jar
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-gpg-plugin
+ 1.6
+
+
+ sign-artifacts
+ verify
+
+ sign
+
+
+ ${gpg.keyname}
+ ${gpg.passphrase}
+
+ --pinentry-mode
+ loopback
+
+
+
+
+
+
+
+
+
+
+ 1.8
+ 1.8
+
+
+
+ junit
+ junit-dep
+ 4.11
+ test
+
+
+ org.mockito
+ mockito-core
+ 1.10.19
+ test
+
+
+ org.json
+ json
+ 20231013
+
+
+ org.skyscreamer
+ jsonassert
+ 1.5.0
+ test
+
+
+
+
+
+ org.jacoco
+ jacoco-maven-plugin
+ 0.8.5
+
+
+
+ prepare-agent
+
+
+
+ report
+ test
+
+ report
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.8.1
+
+ 1.8
+ 1.8
+
+
+
+ org.apache.maven.plugins
+ maven-release-plugin
+ 2.4.2
+
+
+ org.apache.maven.scm
+ maven-scm-provider-gitexe
+ 1.8.1
+
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+ 2.2.1
+
+
+ attach-sources
+
+ jar
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ 2.9.1
+
+
+ attach-javadocs
+
+ jar
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-assembly-plugin
+ 3.1.1
+
+
+ jar-with-dependencies
+
+
+
+
+ make-assembly
+ package
+
+ single
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/scripts/generate_upload_policy.php b/scripts/generate_upload_policy.php
deleted file mode 100755
index 18fdf82..0000000
--- a/scripts/generate_upload_policy.php
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/env php
-$blocksize)
- $key=pack('H*', $hashfunc($key));
- $key=str_pad($key,$blocksize,chr(0x00));
- $ipad=str_repeat(chr(0x36),$blocksize);
- $opad=str_repeat(chr(0x5c),$blocksize);
- $hmac = pack(
- 'H*',$hashfunc(
- ($key^$opad).pack(
- 'H*',$hashfunc(
- ($key^$ipad).$data
- )
- )
- )
- );
- return bin2hex($hmac);
-}
-
-/*
- * Used to encode a field for Amazon Auth
- * (taken from the Amazon S3 PHP example library)
- */
-function hex2b64($str)
-{
- $raw = '';
- for ($i=0; $i < strlen($str); $i+=2)
- {
- $raw .= chr(hexdec(substr($str, $i, 2)));
- }
- return base64_encode($raw);
-}
-
-if (count($argv) != 3) {
- echo "Usage: " . $argv[0] . " \n";
- exit(1);
-}
-
-$policy = file_get_contents($argv[1]);
-$secret = $argv[2];
-
-/*
- * Base64 encode the Policy Document and then
- * create HMAC SHA-1 signature of the base64 encoded policy
- * using the secret key. Finally, encode it for Amazon Authentication.
- */
-$base64_policy = base64_encode($policy);
-$signature = hex2b64(hmacsha1($secret, $base64_policy));
-echo "S3_POLICY=\"" . $base64_policy . "\"\nS3_SIGNATURE=\"" . $signature . "\"\n"
-?>
diff --git a/scripts/s3policy.json b/scripts/s3policy.json
deleted file mode 100755
index ae1327c..0000000
--- a/scripts/s3policy.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "expiration": "2100-01-01T12:00:00.000Z",
- "conditions": [
- {"acl": "public-read" },
- {"bucket": "sendgrid-open-source" },
- ["starts-with", "$key", "smtpapi-java/"],
- ["content-length-range", 2048, 268435456],
- ["eq", "$Content-Type", "application/zip"]
- ]
-}
diff --git a/scripts/s3upload.sh b/scripts/s3upload.sh
deleted file mode 100755
index 2808c58..0000000
--- a/scripts/s3upload.sh
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/bash
-
-# From:
-# http://raamdev.com/2008/using-curl-to-upload-files-via-post-to-amazon-s3/
-
-GIT_VERSION=`git rev-parse --short HEAD`
-
-curl -X POST \
- -F "key=smtpapi-java/versions/smtpapi-java-$GIT_VERSION.jar" \
- -F "acl=public-read" \
- -F "AWSAccessKeyId=$S3_ACCESS_KEY" \
- -F "Policy=$S3_POLICY" \
- -F "Signature=$S3_SIGNATURE" \
- -F "Content-Type=application/zip" \
- -F "file=@./repo/com/sendgrid/smtpapi-jar.jar" \
- https://s3.amazonaws.com/$S3_BUCKET
-
-if [ "$TRAVIS_BRANCH" = "master" ]
-then
- curl -X POST \
- -F "key=smtpapi-java/smtpapi-java.jar" \
- -F "acl=public-read" \
- -F "AWSAccessKeyId=$S3_ACCESS_KEY" \
- -F "Policy=$S3_POLICY" \
- -F "Signature=$S3_SIGNATURE" \
- -F "Content-Type=application/zip" \
- -F "file=@./repo/com/sendgrid/smtpapi-jar.jar" \
- https://s3.amazonaws.com/$S3_BUCKET
-fi
-
-exit 0
diff --git a/src/main/java/com/sendgrid/smtpapi/SMTPAPI.java b/src/main/java/com/sendgrid/smtpapi/SMTPAPI.java
index feec280..61cdd9f 100644
--- a/src/main/java/com/sendgrid/smtpapi/SMTPAPI.java
+++ b/src/main/java/com/sendgrid/smtpapi/SMTPAPI.java
@@ -1,11 +1,12 @@
package com.sendgrid.smtpapi;
-import java.util.Map;
-import java.util.ArrayList;
+import java.util.ArrayList;
+import java.util.Map;
import org.json.JSONArray;
-import org.json.JSONObject;
import org.json.JSONException;
+import org.json.JSONObject;
+
public class SMTPAPI {
diff --git a/src/test/java/com/sendgrid/smtpapi/ProjectTest.java b/src/test/java/com/sendgrid/smtpapi/ProjectTest.java
new file mode 100644
index 0000000..dae3b3a
--- /dev/null
+++ b/src/test/java/com/sendgrid/smtpapi/ProjectTest.java
@@ -0,0 +1,56 @@
+import org.junit.Test;
+
+import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
+import static org.junit.Assert.assertEquals;
+
+public class ProjectTest {
+
+ // ./.env_sample
+ @Test public void checkEnvSampleExists() {
+ assertEquals(true, new File("./.env_sample").exists());
+ }
+
+ // ./.gitignore
+ @Test public void checkGitIgnoreExists() {
+ assertEquals(true, new File("./.gitignore").exists());
+ }
+
+ // ./CHANGELOG.md
+ @Test public void checkChangelogExists() {
+ assertEquals(true, new File("./CHANGELOG.md").exists());
+ }
+
+ // ./CODE_OF_CONDUCT.md
+ @Test public void checkCodeOfConductExists() {
+ assertEquals(true, new File("./CODE_OF_CONDUCT.md").exists());
+ }
+
+ // ./CONTRIBUTING.md
+ @Test public void checkContributingGuideExists() {
+ assertEquals(true, new File("./CONTRIBUTING.md").exists());
+ }
+
+ // ./LICENSE
+ @Test public void checkLicenseExists() {
+ assertEquals(true, new File("./LICENSE").exists());
+ }
+
+ // ./PULL_REQUEST_TEMPLATE.md
+ @Test public void checkPullRequestExists() {
+ assertEquals(true, new File("./PULL_REQUEST_TEMPLATE.md").exists());
+ }
+
+ // ./README.md
+ @Test public void checkReadMeExists() {
+ assertEquals(true, new File("./README.md").exists());
+ }
+
+ // ./TROUBLESHOOTING.md
+ @Test public void checkTroubleShootingGuideExists() {
+ assertEquals(true, new File("./TROUBLESHOOTING.md").exists());
+ }
+
+}
diff --git a/src/test/java/com/sendgrid/smtpapi/SMTPAPITest.java b/src/test/java/com/sendgrid/smtpapi/SMTPAPITest.java
index da4ab09..5a7395f 100644
--- a/src/test/java/com/sendgrid/smtpapi/SMTPAPITest.java
+++ b/src/test/java/com/sendgrid/smtpapi/SMTPAPITest.java
@@ -10,10 +10,10 @@
import static org.junit.Assert.*;
-import java.io.BufferedReader;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
+import java.io.*;
+import java.util.Calendar;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
public class SMTPAPITest {
@@ -53,18 +53,18 @@ public class SMTPAPITest {
@Test public void testAddTo() throws JSONException {
test.addTo("john@doe.com");
- String[] expected = new String[] {"john@doe.com"};
+ String[] expected = new String[]{"john@doe.com"};
Assert.assertArrayEquals(expected, test.getTos());
}
@Test public void testAddTos() throws JSONException {
- String[] expected = new String[] {"john@doe.com"};
+ String[] expected = new String[]{"john@doe.com"};
test.addTos(expected);
Assert.assertArrayEquals(expected, test.getTos());
}
@Test public void testSetTos() throws JSONException {
- String[] expected = new String[] {"john@doe.com", "doe@john.com"};
+ String[] expected = new String[]{"john@doe.com", "doe@john.com"};
test.setTos(expected);
Assert.assertArrayEquals(expected, test.getTos());
}
@@ -151,4 +151,49 @@ public class SMTPAPITest {
Assert.assertEquals(expected, test.getSendAt());
}
+ @Test public void testCopyrightDateRange() throws JSONException {
+ int expectedYear = Calendar.getInstance().get(Calendar.YEAR);
+ String copyRightLine = getCopyrightDateRangeLine("LICENSE");
+
+ if (copyRightLine == null || copyRightLine.isEmpty()) Assert.fail("Check your Copyright File");
+
+ final Pattern p = Pattern.compile("Copyright\\s\\(C\\) (\\d+)");
+ Matcher m = p.matcher(copyRightLine);
+
+ if (m.find()) {
+ int actualYear = Integer.valueOf(m.group(1));
+ Assert.assertEquals(expectedYear, actualYear);
+ } else {
+ Assert.fail("Data range pattern not found. Test is invalid.");
+ }
+ }
+
+ private String getCopyrightDateRangeLine(String licenseFilePath) {
+ File file = new File(licenseFilePath);
+ BufferedReader reader = null;
+ String copyRightLine = "";
+
+ try {
+ reader = new BufferedReader(new FileReader(file));
+
+ while ((copyRightLine = reader.readLine()) != null) {
+ if (copyRightLine.contains("Copyright (C)")) { // do no more work once we find line of interest
+ break;
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ finally {
+ try {
+ if (reader != null) {
+ reader.close();
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ return copyRightLine;
+ }
}
diff --git a/static/img/github-fork.png b/static/img/github-fork.png
new file mode 100644
index 0000000..6503be3
Binary files /dev/null and b/static/img/github-fork.png differ
diff --git a/static/img/github-sign-up.png b/static/img/github-sign-up.png
new file mode 100644
index 0000000..491392b
Binary files /dev/null and b/static/img/github-sign-up.png differ
diff --git a/twilio_sendgrid_logo.png b/twilio_sendgrid_logo.png
new file mode 100644
index 0000000..a4c2223
Binary files /dev/null and b/twilio_sendgrid_logo.png differ