Skip to content

Commit

Permalink
Merge pull request #391 from GoogleCloudPlatform/xmpp
Browse files Browse the repository at this point in the history
Fix up sendgrid README
  • Loading branch information
jerjou authored Oct 28, 2016
2 parents a02cbf3 + a5cedb0 commit fa247e5
Showing 1 changed file with 23 additions and 10 deletions.
33 changes: 23 additions & 10 deletions compute/sendgrid/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ For more information about SendGrid, see their

[sample-docs]: https://cloud.google.com/compute/docs/tutorials/sending-mail/using-sendgrid

## Running on Compute Engine
## Running on Compute Engine

To run the sample, you will need to do the following:

Expand All @@ -20,17 +20,30 @@ To run the sample, you will need to do the following:
1. Create a compute instance on the Google Cloud Platform Developer's Console
1. SSH into the instance you created
1. Update packages and install required packages
sudo apt-get update && sudo apt-get install git-core openjdk-8-jdk maven

sudo apt-get update && sudo apt-get install git-core openjdk-8-jdk maven

1. Clone the repo
git clone https://github.com/GoogleCloudPlatform/java-docs-samples.git
1. Configure your SendGrid settings in the java class (SENDGRID_API_KEY, SENDGRID_SENDER, TO_EMAIL)
java-docs-samples/compute/sendgrid/src/main/java/com/example/compute/sendgrid/SendEmailServlet.java
1. Navigate back to ./sendgrid and use maven to package the class as a jar
mvn clean package

git clone https://github.com/GoogleCloudPlatform/java-docs-samples.git

1. Configure your SendGrid settings in the java class (`SENDGRID_API_KEY`,
`SENDGRID_SENDER`, `TO_EMAIL`)

java-docs-samples/compute/sendgrid/src/main/java/com/example/compute/sendgrid/SendEmailServlet.java

1. Navigate back to `./sendgrid` and use maven to package the class as a jar

mvn clean package

1. Switch to the target directory with the jar file and enable execution on that file
chmod +x compute-sendgrid-1.0-SNAPSHOT-jar-with-dependencies.jar

chmod +x compute-sendgrid-1.0-SNAPSHOT-jar-with-dependencies.jar

1. Make sure that openjdk 8 is the selected java version
sudo update-alternatives --config java

sudo update-alternatives --config java

1. Execute the jar file and send an email (make sure you are in the target folder)
java -jar compute-sendgrid-1.0-SNAPSHOT-jar-with-dependencies.jar

java -jar compute-sendgrid-1.0-SNAPSHOT-jar-with-dependencies.jar

0 comments on commit fa247e5

Please sign in to comment.