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())) {
final String to = info.getNotificationEmail();
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 {
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>
<head>
<title>OAI Harvesting Failed</title>
<title>Failure Notification</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<p>
Hi,<br /><br />
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>
Dear <span th:text="${info.notificationEmail}"></span>,
<br /><br />
<a>Detailed information are available invoking the following API:</a>
<a th:href="${baseUrl} + '/api/history/' + ${info.id}" th:text="${baseUrl} + '/api/history/' + ${info.id}"></a><br />
<br /><br />
Best Regards.
I hope this email finds you well.
I regret to inform you that your request to collect metadata from the provided URL was not completed successfully.<br />
<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>
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 />
<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>
</html>

View File

@ -1,29 +1,34 @@
<html>
<head>
<title>OAI Harvesting Completed</title>
<title>Success Notification</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<p>
Hi,<br /><br />
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 />
has been completed successfully.<br />
<p>
Dear <span th:text="${info.notificationEmail}"></span>,
<br /><br />
I hope this email finds you well.
I am writing to inform you that your request to collect metadata from the provided URL has been completed successfully.<br />
<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}">
You can download your file at the address:<br />
<a th:href="${info.publicUrl}" th:text="${info.publicUrl}"></a>
<br />
You can now download your file by visiting the following address:<br />
<a th:href="${info.publicUrl}" th:text="${info.publicUrl}"></a><br />
</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 />
<br />
</p>
<p>Best Regards.</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 />
<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>
</html>