diff --git a/.classpath b/.classpath index cb479a4..7ac7040 100644 --- a/.classpath +++ b/.classpath @@ -12,8 +12,27 @@ - - + + + + + + + + + + + + + + + + + + + + + diff --git a/WebContent/WEB-INF/lib/activation.jar b/WebContent/WEB-INF/lib/activation.jar new file mode 100644 index 0000000..29a59a9 Binary files /dev/null and b/WebContent/WEB-INF/lib/activation.jar differ diff --git a/WebContent/WEB-INF/lib/mail.jar b/WebContent/WEB-INF/lib/mail.jar new file mode 100644 index 0000000..e4159c3 Binary files /dev/null and b/WebContent/WEB-INF/lib/mail.jar differ diff --git a/WebContent/WEB-INF/lib/servlet-api.jar b/WebContent/WEB-INF/lib/servlet-api.jar new file mode 100644 index 0000000..9793d17 Binary files /dev/null and b/WebContent/WEB-INF/lib/servlet-api.jar differ diff --git a/WebContent/WEB-INF/lib/smtp.jar b/WebContent/WEB-INF/lib/smtp.jar new file mode 100644 index 0000000..51d3421 Binary files /dev/null and b/WebContent/WEB-INF/lib/smtp.jar differ diff --git a/WebContent/html/webpages/navbar.jsp b/WebContent/html/webpages/navbar.jsp index ab4cbb2..94ebbc5 100644 --- a/WebContent/html/webpages/navbar.jsp +++ b/WebContent/html/webpages/navbar.jsp @@ -1,4 +1,4 @@ -<%@ page import = "database.*,entities.User" %> +<%@ page import = "database.*,entities.User,utilities.Mail" %> <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<% + + Mail mail = new Mail(); + mail.send(); + + Cookie[] usercookies = request.getCookies(); String navsso = "invalid"; String navname = "error"; diff --git a/WebContent/html/webpages/orderFormHandler.jsp b/WebContent/html/webpages/orderFormHandler.jsp index 469a6f2..2b6fb02 100644 --- a/WebContent/html/webpages/orderFormHandler.jsp +++ b/WebContent/html/webpages/orderFormHandler.jsp @@ -57,6 +57,10 @@ for(int i=0; i window.location.replace("shoppingCart.jsp"); diff --git a/WebContent/html/webpages/shoppingCart.jsp b/WebContent/html/webpages/shoppingCart.jsp index f124fbe..9da9d6c 100644 --- a/WebContent/html/webpages/shoppingCart.jsp +++ b/WebContent/html/webpages/shoppingCart.jsp @@ -498,7 +498,7 @@ function selectAllDevices() { This function takes all devices in the shopping cart and deletes them. **/ function deleteAll(){ - var response = confirm("Are you sure you'd like to order the selected items?"); + var response = confirm("Are you sure you'd like to empty your cart?"); if(response == true){ //if they confirm cart = new Array; //empty cart localStorage.setItem('cart',JSON.stringify(cart)); //update local storage diff --git a/lib/activation.jar b/lib/activation.jar new file mode 100644 index 0000000..29a59a9 Binary files /dev/null and b/lib/activation.jar differ diff --git a/lib/mail.jar b/lib/mail.jar new file mode 100644 index 0000000..e4159c3 Binary files /dev/null and b/lib/mail.jar differ diff --git a/lib/smtp.jar b/lib/smtp.jar new file mode 100644 index 0000000..51d3421 Binary files /dev/null and b/lib/smtp.jar differ diff --git a/src/utilities/Mail.java b/src/utilities/Mail.java new file mode 100644 index 0000000..674e0ab --- /dev/null +++ b/src/utilities/Mail.java @@ -0,0 +1,67 @@ +package utilities; + +import java.awt.HeadlessException; +import java.util.*; +import javax.mail.*; +import javax.mail.internet.*; +import javax.activation.*; + + +public class Mail { + + public Mail() { + } + public void email() { + String from = "arclaxton@gmail.com"; + String password = "*****"; + String to = "arclaxton@gmail.com"; + String subject = "test"; + String msg = "this is a test"; + Properties properties = System.getProperties(); + properties = setProp(from, to); + Session session = Session.getInstance(properties, new Authenticator() { + protected PasswordAuthentication getPasswordAuthentication(){ + return new PasswordAuthentication(from, password); + } + }); + + try { + Address address = new InternetAddress(to); + MimeMessage message = new MimeMessage(session); + message.setFrom(address); + message.addRecipient(Message.RecipientType.TO, address); + message.setSubject(subject); + message.setText(msg); + message.saveChanges(); + Transport.send(message); + System.out.println("Sent message successfully...."); + + } catch (Exception mex) { + mex.printStackTrace(); + } + + } + + private Properties setProp(String email, String targetEmail) { + Properties props = null; + try { + props = System.getProperties(); + props.setProperty("mail.transport.protocol", "smtp"); + if (email.contains(",") || targetEmail.contains(",")) { + System.out.println("Please send one email to one person at a time..."); + } else if (email.contains("@gmail.com")) { + props.put("mail.smtp.host", "smtp.gmail.com"); + props.put("mail.smtp.socketFactory.port", "465"); + props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); + props.put("mail.smtp.auth", "true"); + props.put("mail.smtp.port", "465"); + } else { + System.out.println("Your Email Address is invalid\n or host not supported!"); + } + + } catch (HeadlessException exp) { + System.out.println(exp); + } + return props; + } +}