Add timestamp to email.
This commit is contained in:
parent
f4c292c36f
commit
c59ca850a6
@ -19,9 +19,15 @@ public class emailVerify {
|
|||||||
static final String emailSMTPPort = "465";
|
static final String emailSMTPPort = "465";
|
||||||
|
|
||||||
public static void SendEmailThroughGmail(String receiverEmail, String User) {
|
public static void SendEmailThroughGmail(String receiverEmail, String User) {
|
||||||
|
//get date for email
|
||||||
Date date = new Date();
|
Date date = new Date();
|
||||||
SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yy");
|
SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yy");
|
||||||
String Date = formatter.format(date);
|
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();
|
Properties props = new Properties();
|
||||||
props.put("mail.smtp.host", emailSMTPserver);
|
props.put("mail.smtp.host", emailSMTPserver);
|
||||||
props.put("mail.smtp.socketFactory.port", emailSMTPPort);
|
props.put("mail.smtp.socketFactory.port", emailSMTPPort);
|
||||||
@ -38,7 +44,7 @@ public class emailVerify {
|
|||||||
message.setRecipients(Message.RecipientType.TO,
|
message.setRecipients(Message.RecipientType.TO,
|
||||||
InternetAddress.parse(receiverEmail));
|
InternetAddress.parse(receiverEmail));
|
||||||
message.setSubject("Obsidian Core Account Login Notice | " + Date);
|
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.");
|
" \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);
|
Transport.send(message);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user