SlideShare a Scribd company logo
8
Most read
11
Most read
12
Most read
JAVA SENDING MAIL
NHÓM THỰC HIỆN:
1. HỒ THỊ THANH THẢO
2. QUANG TUẤN ĐẠT
3. NGUYỄN THÀNH LUÂN
4. NGUYỄN VĂN NGÂN
27/06/2016 1
GVHD: Lê Thanh Trọng
AGENDA
 Introduction
 Protocols
 JavaMail Architecture
 JavaMail API Core Classes
 Sending E-mail Steps
 Demo
27/06/2016 2
INTRODUCTION – WHAT IS IT?
 The JavaMail is an API that is used to
compose, write and read electronic
messages (emails).
27/06/2016 3
INTRODUCTION – WHEN TO USE IT?
 The JavaMail facility can be applied to
many events.
 registering the user (sending confirmation
email)
 forgot password (sending password to the
users email id)
 sending notifications for important
updates etc.
27/06/2016 4
PROTOCOLS USED IN JAVAMAIL API
 SMTP - deliver email
 POP – get mail
 IMAP – get mail
 MIME - format of the messages
 NNTP and others
27/06/2016 5
JAVAMAIL ARCHITECTURE
27/06/2016 6
JAVAMAIL API CORE CLASSES
 javax.mail.Session
 javax.mail.Authenticator
 javax.mail.internet.MimeMessage
 javax.mail.Transport
27/06/2016 7
SENDING EMAIL - STEPS
1. Get the session object
2. Compose the message
3. Send the message
27/06/2016 8
SENDING EMAIL – 1. GET SESSION OBJECT
String to = “xxxxx@gmail.com"; // change accordingly
String from = “yyyyyyy@gmail.com"; // change accordingly
String host = "localhost"; // or IP address
//Get the session object
Properties properties = System.getProperties();
properties.setProperty("mail.smtp.host", host);
Session session = Session.getDefaultInstance (properties);
27/06/2016 9
SENDING EMAIL – 2. COMPOSE THE MESSAGE
// Compose the message
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(from));
message.addRecipient(Message.RecipientType.TO,new Internet
Address(to));
message.setSubject("Ping");
message.setText("Hello, this is example of sending email ");
27/06/2016 10
SENDING EMAIL – 3. SEND MESSAGE
// Send message
Transport.send(message);
System.out.println("message sent successfully....");
27/06/2016 11
RECOMMENDED WEBSITES
 http://www.tutorialspoint.com/javamail_api/ - đọc hiểu
 http://www.javatpoint.com/java-mail-api-tutorial - đọc code
 https://javamail.java.net/nonav/docs/api/ - đọc thêm
27/06/2016 12

More Related Content

PPT
Software Design Patterns
PDF
Java Design Patterns Tutorial | Edureka
PPTX
Server Side Programming
PPT
Spring ppt
DOCX
Final project(news portal system).docx
PDF
SELENIUM PPT.pdf
PPTX
Model view controller (mvc)
PPTX
Software design patterns ppt
Software Design Patterns
Java Design Patterns Tutorial | Edureka
Server Side Programming
Spring ppt
Final project(news portal system).docx
SELENIUM PPT.pdf
Model view controller (mvc)
Software design patterns ppt

What's hot (20)

PPTX
All about decision making statements in php
PDF
Dependency Injection
PPTX
ASP.NET Presentation
DOCX
Spring notes
PPTX
Java Unit Testing
PDF
E learning resource Locator Project Report (J2EE)
PPT
Asp.net basic
PPT
Prototype pattern
PPTX
TestNG with selenium
PDF
Lambda Expressions in Java
PPT
Bridge pattern
PPSX
Observer design pattern
PPTX
Getting started with typescript
PPT
Unit 1 Java
RTF
Project report-on-student-information-management-system-php-mysql
PPTX
Application security models
PPTX
Introduction to c#
PPT
Process models
PPT
Mvc architecture
All about decision making statements in php
Dependency Injection
ASP.NET Presentation
Spring notes
Java Unit Testing
E learning resource Locator Project Report (J2EE)
Asp.net basic
Prototype pattern
TestNG with selenium
Lambda Expressions in Java
Bridge pattern
Observer design pattern
Getting started with typescript
Unit 1 Java
Project report-on-student-information-management-system-php-mysql
Application security models
Introduction to c#
Process models
Mvc architecture
Ad

Viewers also liked (8)

PDF
Simplify360 culture code
PDF
A Whole New Brain for Teachers
PPT
Baocao Web Tech Java Mail
PDF
A Photo Reflection of Fab 8 NeuroELT Conference
PPT
Diseño de un codificador decimal bcd
PPT
Basic SEO Presentation
PPTX
Digital Marketing PPT
PPTX
Digital Marketing Overview
Simplify360 culture code
A Whole New Brain for Teachers
Baocao Web Tech Java Mail
A Photo Reflection of Fab 8 NeuroELT Conference
Diseño de un codificador decimal bcd
Basic SEO Presentation
Digital Marketing PPT
Digital Marketing Overview
Ad

Similar to Java Sending mail (8)

PPT
PDF
Lecture11 b
PPT
PPT
香港六合彩 » SlideShare
PPTX
EMAIL INTRODUCTION (ALL FEATURES INCLUDED).pptx
PPTX
Email: Introduction
PPTX
Mobile Application Development (Sending emails)
PPT
Email
Lecture11 b
香港六合彩 » SlideShare
EMAIL INTRODUCTION (ALL FEATURES INCLUDED).pptx
Email: Introduction
Mobile Application Development (Sending emails)
Email

Recently uploaded (20)

PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPTX
Safety Seminar civil to be ensured for safe working.
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PPTX
web development for engineering and engineering
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPTX
OOP with Java - Java Introduction (Basics)
PPTX
Geodesy 1.pptx...............................................
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPT
Mechanical Engineering MATERIALS Selection
PPTX
Internet of Things (IOT) - A guide to understanding
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPTX
UNIT 4 Total Quality Management .pptx
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PPT
Project quality management in manufacturing
PPT
Introduction, IoT Design Methodology, Case Study on IoT System for Weather Mo...
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
Safety Seminar civil to be ensured for safe working.
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
web development for engineering and engineering
Operating System & Kernel Study Guide-1 - converted.pdf
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
OOP with Java - Java Introduction (Basics)
Geodesy 1.pptx...............................................
Embodied AI: Ushering in the Next Era of Intelligent Systems
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
Mechanical Engineering MATERIALS Selection
Internet of Things (IOT) - A guide to understanding
UNIT-1 - COAL BASED THERMAL POWER PLANTS
UNIT 4 Total Quality Management .pptx
R24 SURVEYING LAB MANUAL for civil enggi
Project quality management in manufacturing
Introduction, IoT Design Methodology, Case Study on IoT System for Weather Mo...
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...

Java Sending mail

  • 1. JAVA SENDING MAIL NHÓM THỰC HIỆN: 1. HỒ THỊ THANH THẢO 2. QUANG TUẤN ĐẠT 3. NGUYỄN THÀNH LUÂN 4. NGUYỄN VĂN NGÂN 27/06/2016 1 GVHD: Lê Thanh Trọng
  • 2. AGENDA  Introduction  Protocols  JavaMail Architecture  JavaMail API Core Classes  Sending E-mail Steps  Demo 27/06/2016 2
  • 3. INTRODUCTION – WHAT IS IT?  The JavaMail is an API that is used to compose, write and read electronic messages (emails). 27/06/2016 3
  • 4. INTRODUCTION – WHEN TO USE IT?  The JavaMail facility can be applied to many events.  registering the user (sending confirmation email)  forgot password (sending password to the users email id)  sending notifications for important updates etc. 27/06/2016 4
  • 5. PROTOCOLS USED IN JAVAMAIL API  SMTP - deliver email  POP – get mail  IMAP – get mail  MIME - format of the messages  NNTP and others 27/06/2016 5
  • 7. JAVAMAIL API CORE CLASSES  javax.mail.Session  javax.mail.Authenticator  javax.mail.internet.MimeMessage  javax.mail.Transport 27/06/2016 7
  • 8. SENDING EMAIL - STEPS 1. Get the session object 2. Compose the message 3. Send the message 27/06/2016 8
  • 9. SENDING EMAIL – 1. GET SESSION OBJECT String to = “xxxxx@gmail.com"; // change accordingly String from = “yyyyyyy@gmail.com"; // change accordingly String host = "localhost"; // or IP address //Get the session object Properties properties = System.getProperties(); properties.setProperty("mail.smtp.host", host); Session session = Session.getDefaultInstance (properties); 27/06/2016 9
  • 10. SENDING EMAIL – 2. COMPOSE THE MESSAGE // Compose the message MimeMessage message = new MimeMessage(session); message.setFrom(new InternetAddress(from)); message.addRecipient(Message.RecipientType.TO,new Internet Address(to)); message.setSubject("Ping"); message.setText("Hello, this is example of sending email "); 27/06/2016 10
  • 11. SENDING EMAIL – 3. SEND MESSAGE // Send message Transport.send(message); System.out.println("message sent successfully...."); 27/06/2016 11
  • 12. RECOMMENDED WEBSITES  http://www.tutorialspoint.com/javamail_api/ - đọc hiểu  http://www.javatpoint.com/java-mail-api-tutorial - đọc code  https://javamail.java.net/nonav/docs/api/ - đọc thêm 27/06/2016 12

Editor's Notes

  • #7: Trình bày quá trình hoạt động thông qua kiến trúc của javaMail