Skip to content

Commit

Permalink
Add licenses to mailjet samples
Browse files Browse the repository at this point in the history
Update readme
Update import order
  • Loading branch information
Shun Fan committed Apr 4, 2016
1 parent 63f5bdc commit 2f78b85
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 12 deletions.
3 changes: 2 additions & 1 deletion appengine/mailjet/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Mailjet sample for Google App Engine
This sample demonstrates how to use [Mailjet](https://www.mailjet.com/) on Google App Engine.
This sample demonstrates how to use [Mailjet](https://www.mailjet.com/) on Google Managed VMs to
send emails from a verified sender you own.

## Setup
1. Before using, ensure the address you plan to send from has been verified in Mailjet.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,30 @@
package com.example.appengine.mailjet;
/**
* Copyright 2016 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import org.json.JSONArray;
import org.json.JSONObject;
package com.example.appengine.mailjet;

import com.mailjet.client.MailjetClient;
import com.mailjet.client.MailjetRequest;
import com.mailjet.client.MailjetResponse;
import com.mailjet.client.errors.MailjetException;
import com.mailjet.client.resource.Email;

import org.json.JSONArray;
import org.json.JSONObject;

import java.io.IOException;

import javax.servlet.ServletException;
Expand Down Expand Up @@ -36,8 +52,7 @@ public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOEx
"Dear passenger, welcome to Mailjet! May the delivery force be with you!")
.property(Email.HTMLPART,
"<h3>Dear passenger, welcome to Mailjet!</h3><br/>May the delivery force be with you!")
.property(Email.RECIPIENTS,
new JSONArray().put(new JSONObject().put("Email", recipient)));
.property(Email.RECIPIENTS, new JSONArray().put(new JSONObject().put("Email", recipient)));

try {
// trigger the API call
Expand Down
14 changes: 14 additions & 0 deletions appengine/mailjet/src/main/webapp/WEB-INF/appengine-web.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- [START_EXCLUDE] -->
<!--
Copyright 2015 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- [END_EXCLUDE] -->
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>YOUR-PROJECT-ID</application>
<version>YOUR-VERSION-ID</version>
Expand Down
15 changes: 15 additions & 0 deletions managed_vms/datastore/src/main/appengine/app.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

runtime: java
vm: true

Expand Down
3 changes: 2 additions & 1 deletion managed_vms/mailjet/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Mailjet sample for Google Managed VMs
This sample demonstrates how to use [Mailjet](https://www.mailjet.com/) on Google Managed VMs.
This sample demonstrates how to use [Mailjet](https://www.mailjet.com/) on Google Managed VMs to
send emails from a verified sender you own.

## Setup
1. Before using, ensure the address you plan to send from has been verified in Mailjet.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,30 @@
package com.example.managedvms.mailjet;
/**
* Copyright 2016 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import org.json.JSONArray;
import org.json.JSONObject;
package com.example.managedvms.mailjet;

import com.mailjet.client.MailjetClient;
import com.mailjet.client.MailjetRequest;
import com.mailjet.client.MailjetResponse;
import com.mailjet.client.errors.MailjetException;
import com.mailjet.client.resource.Email;

import org.json.JSONArray;
import org.json.JSONObject;

import java.io.IOException;

import javax.servlet.ServletException;
Expand Down Expand Up @@ -38,8 +54,7 @@ public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOEx
"Dear passenger, welcome to Mailjet! May the delivery force be with you!")
.property(Email.HTMLPART,
"<h3>Dear passenger, welcome to Mailjet!</h3><br/>May the delivery force be with you!")
.property(Email.RECIPIENTS,
new JSONArray().put(new JSONObject().put("Email", recipient)));
.property(Email.RECIPIENTS, new JSONArray().put(new JSONObject().put("Email", recipient)));

try {
// trigger the API call
Expand Down

0 comments on commit 2f78b85

Please sign in to comment.