Email notification for cert expiry#204
Conversation
| long endOfDay = Long.parseLong( | ||
| formatter.format(targetDate.plusDays(1) | ||
| .atStartOfDay(ZoneOffset.UTC))); |
There was a problem hiding this comment.
yyyyMMddHHmmss produces only digits → safe to parse as long
| long startOfDay = Long.parseLong( | ||
| formatter.format(targetDate.atStartOfDay(ZoneOffset.UTC))); |
There was a problem hiding this comment.
yyyyMMddHHmmss produces only digits → safe to parse as long
…minderTemplate.html Co-authored-by: rowan04 <rowanmoss04@gmail.com>
…minderTemplate.html Co-authored-by: rowan04 <rowanmoss04@gmail.com>
DonaldChung-HK
left a comment
There was a problem hiding this comment.
Hi @garaimanoj, thanks for writing the feature, just a small bit of monitoring so that we can spot and diagnose issue of missing email more easily in the future (just being a bit cautious since it is possible that the issue is from the Postgres DB.)
| certificateService.sendCertificateExpiryReminders(); | ||
|
|
||
| long durationMs = System.currentTimeMillis() - startTime; | ||
| log.info("Completed daily certificate expiry reminder job successfully in {} ms", |
There was a problem hiding this comment.
Maybe a summary of number of SMTP mail pushed for 30 day and 7 day reminder as well so that we can spot the anomaly by comparing this number and expected number from DB. Thanks
There was a problem hiding this comment.
Done
Summary for 7-day expiry reminder (processingDate=2026-05-19): total=1, sent=0, failed=1
| try { | ||
| this.mailSender.send(msg, vars, this.emailUserCertExpiryReminderTemplate); | ||
| } catch (MailException ex) { | ||
| log.error("MailSender " + ex.getMessage()); | ||
| } |
There was a problem hiding this comment.
Maybe a log for CN (that can be toggled on/off) here for monitoring purposes so we know what did or did not get sent successfully to the SMTP server.
DonaldChung-HK
left a comment
There was a problem hiding this comment.
Thanks for adding the logging function. Looks good.
| if(this.emailService.sendEmailReminderToUserOnCertExpiry(cert, daysToExpire)){ | ||
| successCount++; | ||
| } else{ |
There was a problem hiding this comment.
| if(this.emailService.sendEmailReminderToUserOnCertExpiry(cert, daysToExpire)){ | |
| successCount++; | |
| } else{ | |
| if (this.emailService.sendEmailReminderToUserOnCertExpiry(cert, daysToExpire)) { | |
| successCount++; | |
| } else { |
There was a problem hiding this comment.
Thanks, good spot on the formatting.
Sample email in html