diff --git a/docs/manual/docs/administrator-guide/configuring-the-catalog/img/feedback-email.png b/docs/manual/docs/administrator-guide/configuring-the-catalog/img/feedback-email.png new file mode 100644 index 00000000000..5d377748e86 Binary files /dev/null and b/docs/manual/docs/administrator-guide/configuring-the-catalog/img/feedback-email.png differ diff --git a/docs/manual/docs/administrator-guide/configuring-the-catalog/img/feedback-multilingual.png b/docs/manual/docs/administrator-guide/configuring-the-catalog/img/feedback-multilingual.png new file mode 100644 index 00000000000..87044df119d Binary files /dev/null and b/docs/manual/docs/administrator-guide/configuring-the-catalog/img/feedback-multilingual.png differ diff --git a/docs/manual/docs/administrator-guide/configuring-the-catalog/system-configuration.md b/docs/manual/docs/administrator-guide/configuring-the-catalog/system-configuration.md index f9dfb053d0e..29dc2eda3ac 100644 --- a/docs/manual/docs/administrator-guide/configuring-the-catalog/system-configuration.md +++ b/docs/manual/docs/administrator-guide/configuring-the-catalog/system-configuration.md @@ -58,21 +58,41 @@ JVM proxy parameters may also be required to properly set the proxy for all remo ## Feedback {#system-config-feedback} -Email may be sent by the catalog. +Email notifications are sent by the catalog. -- you are using the User Self-registration system -- you are using the metadata status workflow (See [Life cycle](../../user-guide/workflow/life-cycle.md)) -- a file uploaded with a metadata record is downloaded and notify privilege is selected +- When using the User Self-registration system. +- When using the metadata status workflow (See [Life cycle](../../user-guide/workflow/life-cycle.md)). +- When a file uploaded with a metadata record is downloaded and notify privilege is selected. This section configure the mail server to use. - **Email** This is the administrator's email address used to send feedback. - **SMTP host** The mail server name or IP address to use for sending emails. - **SMTP port** The SMTP port. -- **Use SSL** Enable SSL mode +- **Use SSL** Enable Secure Sockets Layer (SSL) mode - **User name** Username if connection is required on the SMTP server - **Password** Username password if connection is required on the SMTP server +- **Use TLS** Enable use of Transport Layer Security (TLS) +![](img/feedback-email.png) + +Additional settings are available to respect user language preference: + +- **Language for system generated emails** The ui language will be used when sending notification emails by default. To To override this behaviour and generate a multi-lingual notification email list the langauges to be used. + +- **Translation follows text** Provide an introduction phrase indicating a multi-lingual notification follows. + +![](img/feedback-multilingual.png) + +!!! note + + Email notifications for metadata publication are sent as `text/html` messages, this can be changed using ```WEB-INF/config.properties``` configuration: + + ```properties + # Configure the metadata publication notification mails to be sent as HTML (true) or TEXT (false) + metadata.publicationmail.format.html=true + ``` + ## Metadata search results Configuration settings in this group determine what the limits are on user interaction with the search results. diff --git a/services/src/main/java/org/fao/geonet/util/MetadataPublicationMailNotifier.java b/services/src/main/java/org/fao/geonet/util/MetadataPublicationMailNotifier.java index 02eab897564..64e65f71a8a 100644 --- a/services/src/main/java/org/fao/geonet/util/MetadataPublicationMailNotifier.java +++ b/services/src/main/java/org/fao/geonet/util/MetadataPublicationMailNotifier.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001-2023 Food and Agriculture Organization of the + * Copyright (C) 2001-2024 Food and Agriculture Organization of the * United Nations (FAO-UN), United Nations World Food Programme (WFP) * and United Nations Environment Programme (UNEP) * @@ -34,6 +34,7 @@ import org.fao.geonet.repository.GroupRepository; import org.fao.geonet.utils.Log; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import java.util.*; @@ -48,6 +49,9 @@ @Component public class MetadataPublicationMailNotifier { + @Value("${metadata.publicationmail.format.html:true}") + private boolean sendHtmlMail; + @Autowired SettingManager settingManager; @@ -136,7 +140,6 @@ private void sendMailPublicationNotification(Locale[] feedbackLocales, LocalizedEmailComponent emailMessageComponent = new LocalizedEmailComponent(MESSAGE, "metadata_published_text", KeyType.MESSAGE_KEY, POSITIONAL_FORMAT); for (Locale feedbackLocale : feedbackLocales) { - emailSubjectComponent.addParameters( feedbackLocale, new LocalizedEmailParameter(ParameterType.RAW_VALUE, 1, settingManager.getSiteName()) @@ -175,15 +178,19 @@ private void sendMailPublicationNotification(Locale[] feedbackLocales, ); } - LocalizedEmail localizedEmail = new LocalizedEmail(true); + LocalizedEmail localizedEmail = new LocalizedEmail(sendHtmlMail); localizedEmail.addComponents(emailSubjectComponent, emailMessageComponent); String subject = localizedEmail.getParsedSubject(feedbackLocales); - String htmlMessage = localizedEmail.getParsedMessage(feedbackLocales); + String message = localizedEmail.getParsedMessage(feedbackLocales); // Send mail to notify about metadata publication / un-publication try { - MailUtil.sendHtmlMail(toAddress, subject, htmlMessage, settingManager); + if (sendHtmlMail) { + MailUtil.sendHtmlMail(toAddress, subject, message, settingManager); + } else { + MailUtil.sendMail(toAddress, subject, message, settingManager); + } } catch (IllegalArgumentException ex) { Log.warning(API.LOG_MODULE_NAME, ex.getMessage(), ex); } diff --git a/web/src/main/webResources/WEB-INF/config.properties b/web/src/main/webResources/WEB-INF/config.properties index a4df6a6798f..585aac2bc5c 100644 --- a/web/src/main/webResources/WEB-INF/config.properties +++ b/web/src/main/webResources/WEB-INF/config.properties @@ -58,3 +58,6 @@ map.bbox.background.service=https://ows.terrestris.de/osm/service?SERVICE=WMS&am metadata.extentApi.disableFullUrlBackgroundMapServices=true db.migration_onstartup=true + +# Configure the metadata publication notification mails to be sent as HTML (true) or TEXT (false) +metadata.publicationmail.format.html=true \ No newline at end of file