Introduction
In this article, we will study how to send emails and include attachments using Spring as our Java framework, SendGrid as our email service, and jQuery-File-Upload as our jQuery plugin. This article is the culmination of my previous articles about email and file upload (see below)I advise my readers to read those articles first before reading this guide to understand how to send email with SendGrid and how to upload files with jQuery.
Table of Contents
Part 1: Introduction and Functional SpecsPart 2: Java classes
Part 3: XML configuration
Part 4: HTML form
Part 5: Running the Application
Dependencies
- Spring core 3.1.0.RELEASE
- SendGrid account (you're required to sign-up first)
- jQuery-File-Upload
- See pom.xml for details
Github
To access the source code, please visit the project's Github repository (click here)
Functional Specs
Let's define our application's requirements:- Create a simple form where users can compose and send emails
- Emails do not need to be persisted in a database
- Users can attach multiple files
- Send email via HTTP instead of SMTP to avoid firewall issues
Here's our Use Case diagram:
What is SendGrid?
SendGrid's cloud-based email infrastructure relieves businesses of the cost and complexity of maintaining custom email systems. SendGrid provides reliable delivery, scalability and real-time analytics along with flexible API's that make custom integration a breeze.
Source: http://www.sendgrid.com
Screenshots
Let's preview how our application will look like after it has been completed. This is also a good way to clarify further our application's specsCompose email form
This is the entry page where users can compose and send emails.
Email with attachments
Notice we can attach multiple files and display their file sizes
Success alert
After clicking "Send", the email message is sent. An alert is shown to confirm the action.
Reset alert
When user clicks on "Reset", the contents of the fields are cleared. An alert is shown to confirm the action.
Sample emails
This is the sample email received from Gmail:
This is the sample email received from Yahoo:
Next
In the next section, we will start writing the Java classes, discuss the jQuery-File-Upload process, and the SendGrid API for sending attachments. Click here to proceed.
Share the joy:
|
Subscribe by reader Subscribe by email Share
I have read your blog its very attractive and impressive. I like it your blog.
ReplyDeleteSpring online training Spring online training Spring Hibernate online training Spring Hibernate online training Java online training
spring training in chennai spring hibernate training in chennai
very useful post, thank you so much.
ReplyDeleteOh! This article has suggested to me many new ideas. I will embark on doing it. Hope you can continue to contribute your talents in this area. Thank you.
ReplyDeleteludo king
I won't make such a project that will send bulk emails from a web app using Spring, JavaScript, and Java. I want to upload an email list by drag & drop and set up the necessary descriptions of mail from front end side and attachment with scheduler after click send button mail will go to the given recipients from the bulk upload. Is there any example of this project?
ReplyDeletepalm angels clothing
ReplyDeleteyeezy outlet
supreme
curry shoes
goyard bag
supreme outlet
nike sb dunk low
golden goose sneakers
golden goose sale
kd shoes