Add timestamp to email.

This commit is contained in:
James Quinley 2022-02-09 11:09:13 -08:00
parent f4c292c36f
commit c59ca850a6

View File

@ -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);