Skip to content

sendgrid/sendgrid-java-sample-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SendGrid Sample App - Java

This git repository helps you to send emails quickly and easily through SendGrid using Java.

Create an SendGrid account at http://sendgrid.com/pricing.html

Clone SendGrid application on your local machine

    git clone https://github.com/sendgrid/sendgrid-java-sample-app

###Configuration###

Configure src/com/sendgrid/SendGridJavaSampleApplicationSendServlet.java file with your information:

Update the <sendgrid_username> and <sendgrid_password> with your SendGrid Credentials and <from_email> with your email address.

	// initialize Sendgrid class
	// please replace "<sendgrid_username>" and "<sendgrid_password>" with your SendGrid credentials
	SendGrid mail = new SendGrid("<sendgrid_username>","<sendgrid_password>");
	// set to address, from address, subject, the html/text content and send the email 
	String response = mail.addTo(req.getParameter("emailto"))
	  // update the <from_email> with your email address
	  .setFrom("<from_email>")
	  .setSubject(req.getParameter("subject"))
	  .setText(req.getParameter("content"))
	  .setHtml("")
	  .send();

Build your application and deploy to your webserver.

For more information you can visit our Java Library

About

No description, website, or topics provided.

Resources

Stars

4 stars

Watchers

187 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors