mail messages

This commit is contained in:
Michele Artini 2023-10-04 16:02:55 +02:00
parent 5443962e9b
commit 43f387114f
3 changed files with 43 additions and 27 deletions

View File

@ -88,9 +88,11 @@ public class EmailSender {
if (StringUtils.isNotBlank(info.getNotificationEmail())) { if (StringUtils.isNotBlank(info.getNotificationEmail())) {
final String to = info.getNotificationEmail(); final String to = info.getNotificationEmail();
if (info.getExecutionStatus() == ExecutionStatus.COMPLETED) { if (info.getExecutionStatus() == ExecutionStatus.COMPLETED) {
sendMail(to, "OAI Harvesting completed", prepareMessage("email/success", info)); final String subject = String.format("Success Notification: Metadata Collection Request (ID: %s)", info.getId());
sendMail(to, subject, prepareMessage("email/success", info));
} else { } else {
sendMail(to, "OAI Harvesting completed", prepareMessage("email/failure", info)); final String subject = String.format("Failure Notification: Metadata Collection Request (ID: %s)", info.getId());
sendMail(to, subject, prepareMessage("email/failure", info));
} }
} }
} }

View File

@ -1,22 +1,31 @@
<html> <html>
<head> <head>
<title>OAI Harvesting Failed</title> <title>Failure Notification</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head> </head>
<body> <body>
<p> <p>
Hi,<br /><br /> Dear <span th:text="${info.notificationEmail}"></span>,
your request (<b>ID:</b> <span th:text="${info.id}"></span>) to collect metadata from<br />
<a th:href="${info.oaiBaseUrl}" th:text="${info.oaiBaseUrl}"></a><br />
is failed for the following error:<br />
<pre th:text="${info.message}"></pre>
<br /><br /> <br /><br />
<a>Detailed information are available invoking the following API:</a> I hope this email finds you well.
<a th:href="${baseUrl} + '/api/history/' + ${info.id}" th:text="${baseUrl} + '/api/history/' + ${info.id}"></a><br /> I regret to inform you that your request to collect metadata from the provided URL was not completed successfully.<br />
<br /><br /> <b>Request ID:</b> <span th:text="${info.id}"></span><br />
Best Regards. <b>URL:</b> <a th:href="${info.oaiBaseUrl}" th:text="${info.oaiBaseUrl}"></a><br />
</p> </p>
<p>
We encountered an unexpected issue while processing your request, and as a result, the metadata collection could not be completed. We apologize for any inconvenience caused.
Should you require more detailed information, please feel free to invoke the following API:
<a th:href="${baseUrl} + '/api/history/' + ${info.id}" th:text="${baseUrl} + '/api/history/' + ${info.id}"></a><br />
<br />
</p>
<p>
If you have any further questions or need assistance, please don't hesitate to reach out. We are here to help!<br /><br />
Best Regards,<br /><br />
EOSC Metadata Harvester daemon<br />
</p>
<hr /> <hr />
<p>This is an automatically generated message. Please do not reply.</p>
<p>Note: This is an automatically generated message. Please do not reply directly to this email.</p>
</body> </body>
</html> </html>

View File

@ -1,29 +1,34 @@
<html> <html>
<head> <head>
<title>OAI Harvesting Completed</title> <title>Success Notification</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head> </head>
<body> <body>
<p> <p>
Hi,<br /><br /> Dear <span th:text="${info.notificationEmail}"></span>,
your request (<b>ID:</b> <span th:text="${info.id}"></span>) to collect metadata from<br /> <br /><br />
<a th:href="${info.oaiBaseUrl}" th:text="${info.oaiBaseUrl}"></a><br /> I hope this email finds you well.
has been completed successfully.<br /> I am writing to inform you that your request to collect metadata from the provided URL has been completed successfully.<br />
<p> <b>Request ID:</b> <span th:text="${info.id}"></span><br />
<b>URL:</b> <a th:href="${info.oaiBaseUrl}" th:text="${info.oaiBaseUrl}"></a><br />
</p>
<p th:if="${info.publicUrl}"> <p th:if="${info.publicUrl}">
You can download your file at the address:<br /> You can now download your file by visiting the following address:<br />
<a th:href="${info.publicUrl}" th:text="${info.publicUrl}"></a> <a th:href="${info.publicUrl}" th:text="${info.publicUrl}"></a><br />
<br />
</p> </p>
<a>Detailed information are available invoking the following API:</a><br /> <p>
Should you require more detailed information, please feel free to invoke the following API: <br />
<a th:href="${baseUrl} + '/api/history/' + ${info.id}" th:text="${baseUrl} + '/api/history/' + ${info.id}"></a><br /> <a th:href="${baseUrl} + '/api/history/' + ${info.id}" th:text="${baseUrl} + '/api/history/' + ${info.id}"></a><br />
<br />
</p> </p>
<p>
<p>Best Regards.</p> If you have any further questions or need assistance, please don't hesitate to reach out. We are here to help!<br /><br />
Best Regards,<br /><br />
EOSC Metadata Harvester daemon<br />
</p>
<hr /> <hr />
<p>This is an automatically generated message. Please do not reply.</p> <p>Note: This is an automatically generated message. Please do not reply directly to this email.</p>
</body> </body>
</html> </html>