From 2f78b8556e76297128224ea703591a34489b75ae Mon Sep 17 00:00:00 2001 From: Shun Fan Date: Mon, 4 Apr 2016 11:39:09 -0700 Subject: [PATCH] Add licenses to mailjet samples Update readme Update import order --- appengine/mailjet/README.md | 3 ++- .../appengine/mailjet/MailjetServlet.java | 25 +++++++++++++++---- .../src/main/webapp/WEB-INF/appengine-web.xml | 14 +++++++++++ .../datastore/src/main/appengine/app.yaml | 15 +++++++++++ managed_vms/mailjet/README.md | 3 ++- .../managedvms/mailjet/MailjetServlet.java | 25 +++++++++++++++---- 6 files changed, 73 insertions(+), 12 deletions(-) diff --git a/appengine/mailjet/README.md b/appengine/mailjet/README.md index 0e452df388b..0a9bddaaac7 100644 --- a/appengine/mailjet/README.md +++ b/appengine/mailjet/README.md @@ -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. diff --git a/appengine/mailjet/src/main/java/com/example/appengine/mailjet/MailjetServlet.java b/appengine/mailjet/src/main/java/com/example/appengine/mailjet/MailjetServlet.java index abc5b7d24d8..e5528dd540f 100644 --- a/appengine/mailjet/src/main/java/com/example/appengine/mailjet/MailjetServlet.java +++ b/appengine/mailjet/src/main/java/com/example/appengine/mailjet/MailjetServlet.java @@ -1,7 +1,20 @@ -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; @@ -9,6 +22,9 @@ 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; @@ -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, "

Dear passenger, welcome to Mailjet!


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 diff --git a/appengine/mailjet/src/main/webapp/WEB-INF/appengine-web.xml b/appengine/mailjet/src/main/webapp/WEB-INF/appengine-web.xml index b8606139829..5e127cc369f 100644 --- a/appengine/mailjet/src/main/webapp/WEB-INF/appengine-web.xml +++ b/appengine/mailjet/src/main/webapp/WEB-INF/appengine-web.xml @@ -1,4 +1,18 @@ + + + YOUR-PROJECT-ID YOUR-VERSION-ID diff --git a/managed_vms/datastore/src/main/appengine/app.yaml b/managed_vms/datastore/src/main/appengine/app.yaml index 2a659160df5..b45dd027208 100644 --- a/managed_vms/datastore/src/main/appengine/app.yaml +++ b/managed_vms/datastore/src/main/appengine/app.yaml @@ -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 diff --git a/managed_vms/mailjet/README.md b/managed_vms/mailjet/README.md index e20c29e3534..37289ddc7fb 100644 --- a/managed_vms/mailjet/README.md +++ b/managed_vms/mailjet/README.md @@ -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. diff --git a/managed_vms/mailjet/src/main/java/com/example/managedvms/mailjet/MailjetServlet.java b/managed_vms/mailjet/src/main/java/com/example/managedvms/mailjet/MailjetServlet.java index db212079e40..8fedc3cf636 100644 --- a/managed_vms/mailjet/src/main/java/com/example/managedvms/mailjet/MailjetServlet.java +++ b/managed_vms/mailjet/src/main/java/com/example/managedvms/mailjet/MailjetServlet.java @@ -1,7 +1,20 @@ -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; @@ -9,6 +22,9 @@ 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; @@ -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, "

Dear passenger, welcome to Mailjet!


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