CSJCurrent en:Email Notifications: Unterschied zwischen den Versionen
Keine Bearbeitungszusammenfassung |
|||
Zeile 33: | Zeile 33: | ||
<nowiki>[...] | <nowiki>[...] | ||
<p>Dear Sir or Madam,</p> | |||
<p>Confidential data has been sent to you by <a href="mailto:$email">$name</a>. | |||
[...]</nowiki> | |||
=== Possible placeholders in email notifications === | === Possible placeholders in email notifications === | ||
The following table shows available placeholders in email templates. Placeholders tagged with {{Status|type=warning|text=SENDER}} are specifically required for the sender template. Placeholders tagged with {{Status|type=primary|text=RECIPIENT}} are specifically required for the recipient template. | The following table shows available placeholders in email templates. Placeholders tagged with {{Status|type=warning|text=SENDER}} are specifically required for the sender template. Placeholders tagged with {{Status|type=primary|text=RECIPIENT}} are specifically required for the recipient template. | ||
Zeile 187: | Zeile 187: | ||
|} | |} | ||
{{InfoBox|title=|content=Please note that the above table only shows the default configuration for Cryptshare emails. Any placeholder can also be used for a different purpose in own templates. Please read the [[CSSCurrent_en:HTML Email Templates|HTML Email Templates]] in the | {{InfoBox|title=|content=Please note that the above table only shows the default configuration for Cryptshare emails. Any placeholder can also be used for a different purpose in own templates. Please read the [[CSSCurrent_en:HTML Email Templates|HTML Email Templates]] in the Cryptshare Server Documentation for further details. | ||
}} | }} | ||
Aktuelle Version vom 8. Mai 2024, 13:38 Uhr
Disabling email notifications on server-side
Usually the Cryptshare Server manages all email communication between the participants of a transfer. However, when developing an own client application for Cryptshare communication it might be desirable to send these notifications from within this client. Therefore Cryptshare allows it to disable the sender and the recipient notification for each transfer.
Disabling the sender notification for a transfer Transfer transfer = new Transfer(); transfer.setNotifySender(false);
Disabling the recipient notification for a transfer Transfer transfer = new Transfer(); transfer.setNotifyRecipients(false);
Developers of a Cryptshare Client Application might want to handle transfer notifications themselves, for instance for an email integration such as Cryptshare for Outlook. In order to still have the same layout and especially the unique information per recipient the API offers the possibility to request the HTML code for the email notification from the server.
client.requestEmailTemplate("<template-name>", <replacements>, <language>, <mailFormat>);
<template-name> : The name of the desired email template <replacements> : Mapping of the placeholders in the template <language> : The language of the template <mailFormat> : The mail format which shall be used. This can either be 'HTML' or 'plain'
Email placeholders
Email placeholders are used to fill in individual information into the templates. This way each email recipient can retrieve an email with unique content, such as the personal download link, name or email address.
Template Snippet with name and email placeholders [...] <p>Dear Sir or Madam,</p> <p>Confidential data has been sent to you by <a href="mailto:$email">$name</a>. [...]
Possible placeholders in email notifications
The following table shows available placeholders in email templates. Placeholders tagged with SENDER are specifically required for the sender template. Placeholders tagged with RECIPIENT are specifically required for the recipient template.
Tag | Placeholder Key | Description | Additional Notes |
---|---|---|---|
SENDERRECIPIENT |
"baseurl" |
The Cryptshare Server URL | |
RECIPIENT |
"subject" |
The message subject | |
RECIPIENT |
"message" |
The body of the message | |
SENDERRECIPIENT |
"date_1" |
The expiration date of the transfer | |
SENDERRECIPIENT |
"list_3" |
The list of the files in the transfer | |
RECIPIENT |
"linkref" |
The download link for the transfer | |
SENDERRECIPIENT |
"passwordmode" |
The type of password mode used for the transfer |
Possible values:
|
RECIPIENT |
"name" |
The name of the sender | |
RECIPIENT |
"phone" |
The phone number of the sender | |
RECIPIENT |
"email" |
The email address of the sender | |
SENDERRECIPIENT |
"list_1" |
List of the recipients addressed in 'To' | |
SENDERRECIPIENT |
"list_2" |
List of the recipients addressed in 'Cc' |
How to use email placeholders
#client.requestEmailTemplate() requires a very specific replacement-map in order to get the desired result. The parameter is a set holding instances of type TemplateReplacement. A TemplateReplacement object is basically a key-value wrapper where the key is a specific placeholder and the value can either be a list or a single value. This allows it, to retrieve customized templates per recipient with a single request.
Using placeholders // <replacements> Map<Set<String>, Set<TemplateReplacement>> replacements = new HashMap<Set<String>, Set<TemplateReplacement>>(); // <replacementSet> Set<TemplateReplacement> replacementSet = new HashSet<TemplateReplacement>(); replacementSet.add(new TemplateReplacement("name", "John Adams")); replacementSet.add(new TemplateReplacement("email", "john.adams@server.com")); List<String> fileList = new ArrayList<String>(); fileList.add("file_01.txt"); fileList.add("file_02.docx"); replacementSet.add(new TemplateReplacement("list_3", fileList)); List<String> recipientList = new ArrayList<String>(); recipientList.add("recipient1@otherdomain.org"); recipientList.add("recipienr2@otherdomain.com"); replacementSet.add(new TemplateReplacement("list_1, recipientList)); // <identifiers> Set<String> identifiers = new HashSet<String>(); identifiers.addAll(recipientList); replacements.put(identifiers, replacementSet); Map<List<String>, String> mailTemplates = client.requestEmailTemplate("recipient", replacements, new Locale("ja"), EmailFormat.HTML);
<templateName> : The name of the desired email template <replacements> : Mapping between <identifiers> and <replacementSet> <identifiers> : Set of email addresses which have a specific <replacementSet> <replacementSet> : A set of placeholders for <identifiers>
The result object of an email template request
When requesting an email template using #client.requestEmailTemplate() the returned mapping contains a unique template per identifier-set. This means with one request a filled in template can be returned per single recipient or for all recipients together or for a combination of both.
Example: multiple <identifier>-<replacementSet> combinations // identifiers1: One single recipient, replacementSet1: Set of replacements replacements.put(identifiers1, replacementSet1); // identifiers2: Two recipients, replacementSet2: Set of replacements replacements.put(identifiers2, replacementSet2); Map<List<String>, String> mailTemplates = client.requestEmailTemplate("recipient", replacements, new Locale("ja"), EmailFormat.HTML);
The above request would return two templates, one for each set of identifiers put into the replacement map both having a different content, meaning the placeholders have been filled in with the contents of replacementSet1, respectively replacementSet2.