From c59ca850a6b6e17b5b5be3e70a7db05a00cbfd7a Mon Sep 17 00:00:00 2001 From: James Quinley Date: Wed, 9 Feb 2022 11:09:13 -0800 Subject: [PATCH] Add timestamp to email. --- src/main/java/com/jamesquinley/Asecure/emailVerify.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/jamesquinley/Asecure/emailVerify.java b/src/main/java/com/jamesquinley/Asecure/emailVerify.java index 71f6395..c367ded 100644 --- a/src/main/java/com/jamesquinley/Asecure/emailVerify.java +++ b/src/main/java/com/jamesquinley/Asecure/emailVerify.java @@ -19,9 +19,15 @@ public class emailVerify { static final String emailSMTPPort = "465"; public static void SendEmailThroughGmail(String receiverEmail, String User) { + //get date for email Date date = new Date(); SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yy"); String Date = formatter.format(date); + //get time for sign in time + Date dt = new Date(); + SimpleDateFormat dateFormat; + dateFormat = new SimpleDateFormat("kk:mm:ss"); + Properties props = new Properties(); props.put("mail.smtp.host", emailSMTPserver); props.put("mail.smtp.socketFactory.port", emailSMTPPort); @@ -38,7 +44,7 @@ public class emailVerify { message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(receiverEmail)); message.setSubject("Obsidian Core Account Login Notice | " + Date); - message.setText("We detected a new login on your account, if this was you ignore this email, if it wasn't you, please change your password. \n \n \n \n" + + message.setText("We detected a new login on your account " +"(at " + dateFormat.format(dt) + " PDT)" + ", if this was you ignore this email, if it wasn't you, please change your password. \n \n \n \n" + " \n This email (" + receiverEmail + ") is linked to the Obsidian Core Account "+ User + " \n These security emails can't be opted out of. \n \n This was sent on behalf of Obsidian Core Studios by our super cool login robots."); Transport.send(message);