Sie zeigen eine alte Version dieser Seite an. Zeigen Sie die aktuelle Version an.

Unterschiede anzeigen Seitenhistorie anzeigen

Version 1 Nächste Version anzeigen »

globe with meridians Language: Deutsch · English

light bulb Nuclet: Email sending

Data sheet and documentation entry point for the Email sending Nuclet (sending emails from Nuclos processes based on templates).

CONCEPT INTEGRATORS UPDATED: JUL 2026 APPLIES TO NUCLOS 4.2026.X

On this page

Machine-translated – under review

This page was machine-translated from German as a first draft and is currently under review. The authoritative source remains the German original (see the language switch above).

Releases

VersionDateNotesCompatibility
1.1.013.02.2018First published versionfrom Nuclos 4.25.1
1.1.204.07.2019Email queue and improved APIfrom Nuclos 4.33.8
1.1.317.12.2021E-Mail-Templatesfrom Nuclos 4.47.3
1.1.422.11.2022Text blocks: subform data in general and via rule block, dispatch condition for text and attachment blocksfrom Nuclos 4.47.3
1.1.510.02.2023Store emails as filefrom Nuclos 4.47.3
1.1.604.05.2023

wiederkehrende Email-Erinnerungen

from Nuclos 4.47.3
1.1.707.12.2023

recurring email series, parameter for the current date, dispatch condition for subform Addresses

from Nuclos 4.2023.24.2
1.1.811.07.2024

Log draft as preview for an email, mark attachment as mandatory field, show use of blocks

from Nuclos 4.2023.24.2
1.1.916.07.2025

Display and use Nuclos fields, email series according to schedule list, maximum attachment size, allow locked users

from Nuclos 4.2024.26.2

Overview

The Nuclet "E-Mail-Versand" offers additional convenience when using the Nuclos Mail API (see http://api.nuclos.de/org/nuclos/api/provider/MailProvider.html#send(org.nuclos.api.mail.NuclosMail)).

In particular, it enables the redirection of all emails for test purposes or to test environments, as well as the archiving of all sent emails including file attachments for documentation purposes.

In addition, there is a job for sending and receiving emails. This means emails are sent a little later, but can be rolled back after errors so that they are not sent multiple times.

Furthermore, there is also the option to configure templates for emails.

Version 1.1.9

Description of the changes in version 1.1.9

TopicDescription
Display and use Nuclos fields

Nuclos fields are now displayed in the subform Available data fields and can be used in the template texts.

Email series according to schedule list

Email template series can now also be sent at fixed dates (see subform Fixed dates).

The settings under Frequenz haben dann keine Auswirkung.

maximum attachment sizeVia the Nuclet parameter Maximum attachment size the maximum permitted attachment size in MB for dispatch can now be specified (default: "20").
allow locked users

Via the Nuclet parameter Allow locked users sending emails to addresses with a locked user can be allowed (default: "N").

The block Erfasser (Benutzer) liefert bei Sperre kein Ergebnis.

Version 1.1.8

Description of the changes in version 1.1.8

TopicDescription
Log draft as preview for an email
Emails can now be shown to the user as a draft, for example via an object generator. In doing so, an email log is created with the action Entwurf created, which is sent automatically on saving. One use case would be, for example, a quotation that can still be supplemented with specific texts, recipients or attachments.

 

Anhang als Pflichtfeld markieren

Email attachments can now, in the subform Attachments des Layouts E-Mail-Template be marked as mandatory (Mandatory field?). If the calculation yields no attachment, an error message appears and the email is not sent.

Verwendung von Bausteinen anzeigen

The use of individual blocks can now be shown in the layout E-Mail-Template-Bausteine (all instances) are displayed. From there you can jump directly to the respective usage.

Version 1.1.7

Description of the changes in version 1.1.7

TopicDescription
wiederkehrende Email-Serien

The field Serientyp im Bereich Further properties im E-Mail-Template enables the configuration of recurring series by email, e.g. to send reports regularly. Series with different patterns (see screenshot) can be created and linked.

The emails are sent via the job Versende Erinnerungen sent daily if the criteria apply.

Series can only take effect from a date (Beginn) and optionally end on a certain date (Ende).

The new Nuclet parameter Base date for series can be changed if necessary to catch up on past series or to test the functionality:

Format: "TT.MM.JJJJ"

Current date with "."

Parameter for the current date

A new parameter with the following syntax makes it possible to perform calculations with the current date. Days, months or years can be added or subtracted.

...
 <b>bis spätestens ##{(HEUTE|TODAY)([+-][0-9]{1,4})([TD]|M|[JY])}</b>
...

Examples:

Current day
##{HEUTE}
14 days ago
##{HEUTE-14T}
In three months
##{TODAY+3M}
Next year##{HEUTE+1J}

Dispatch condition for subform Addresses

It is now also possible, in the subform Addresses dispatch conditions can be stored - they decide whether the respective address line is included in the email.

Version 1.1.6

Description of the changes in version 1.1.6

TopicDescription
wiederkehrende Email-Erinnerungen

The tab Erinnerungen im Reiter Konfiguration im E-Mail-Template enables the configuration of recurring reminders by email. A positive value for the reminder interval can be set for each status (Kalendertage) and optionally the positive number of repetitions (otherwise unlimited).

The emails are sent via the job Versende Erinnerungen sent daily if the criteria apply.

Reminders can only take effect from a date (Valid from) and, if needed, further via a Versandbedingung be restricted.

The reference date is always the day of the relevant state change.

Parameter in E-Mails

Parameters provided via rules if applicable (org.nuclet.emailversand.EMailContext.TemplateParameters) can now also be addressed in the template, e.g. for the reminders with the following syntax.

...
die o.g. Rechnung ist seit §§{INTDAYSPAST} Tagen im Status <i>20 - Prüfung</i>.
...

Version 1.1.5

Description of the changes in version 1.1.5

TopicDescription
Store emails as file

Under Dateiablage-BO im E-Mail-Template relevant subtables with a file attachment are now offered for selection.

If selected, the emails sent via this template are saved in the corresponding BO as an .eml file.


Version 1.1.4

Description of the changes in version 1.1.4

TopicDescription
Text blocks: subform data in general and via rule block

You can now either output all subform data in tabular form (base BO generated from subform) or additionally restrict this via a rule block (generated from rule block).

 

Such text blocks are output as a table via a further text block.

Dispatch condition for text and attachment blocks

A dispatch condition can now be specified for text and attachment blocks.

 

Version 1.1.3

Beschreibung von Version 1.1.3

TopicDescription
E-Mail Template

The BO E-Mail-Template offers the option to create templates for emails, which can then be sent from within rules. This gives an administrator the option to design the emails sent by Nuclos themselves and to change them at short notice. The templates offer many options for this:

  • Access to arbitrarily deeply referenced attributes from a freely selectable base BO (e.g. sales order), similar to Nuclos forms
  • Various sources of addresses (attribute, Nuclet parameter, user, user group, ...)
  • Various sources of attachments (file, form, ...)
  • Different languages of subject, message and attachment
  • Text blocks
  • Email recipients that determine the email address, salutation and language of the email
  • Standardised and configurable footers and signatures
  • Preview and test of the template

More complex email components, such as a table with all sales order items, must be supported by a rule.

E-Mail Baustein

Blocks can be defined that are then available in the email templates. Possible are

Textbaustein

  • Reine (ggf. mehrsprachige) Standard-Textbausteine (AGB, Versandinfos, Signatur, ...)
  • Blocks that provide a footer or a signature

Regelbaustein

  • Complex blocks that require rule support (e.g. table with sales order items)
  • Blocks that determine one or more email addresses (e.g. for subscribe functionalities)
  • Blocks that define a language

Recipients

  • Blocks that define the email recipient (address, salutation, language)

Anhang

  • Blocks that generate an attachment

Versandbedingung

  • Blocks that decide whether an email should be sent or not

For safety, blocks can be restricted to certain BOs, e.g. if the block Bearbeiter  for the BOs Rechnung and Sales order exists but not for the BO Articles 

E-Mail SpracheDefines the available languages
Regelbausteine

To create an email from an email template, an instance of a class must be passed that implements the interface Regelbausteine  is implemented.

The Nuclet comes with an implementation that contains some examples. If you need your own rule blocks, you should create your own implementation in your Nuclet so that it is not overwritten when the email Nuclet is updated.

In the method EMailUtils.getRegelBausteine() then simply create this implementation.

Configuration of email templates from version 1.1.3

Bereich E-Mail-Template
Name Pflicht Eindeutiger Name des Templates
Base NucletoptionalThe Nuclet from which the base BO should come
Base BOoptionalThe BO to which the email refers (e.g. Sales order)
Recipients optionalA rule block that is marked as Recipients  and for which the method getRecipient()  returns a result with email address, salutation and, if applicable, language in the rule block implementation
Recipient BOoptionalIf the recipient is, for example, generally implemented as a rule block for the BO Employees has been implemented can simply be Employees angegeben werden
Recipient roleoptionalIf the Employees occurs in various roles in the base BO, this can be specified here, e.g. Contacts  or Kundenberater  
Footer optionalEin als Footer  marked text block
Signatur optionalEin als Signatur marked text block
Further properties section
Sprache (Baustein)optionalThe language in which the email should be sent, defined by a block marked as Sprache  marked text block
Sprache (statisch)optionalThe language in which the email should be sent, specified directly
Html?optionalEmail is sent in HTML format (recommended)
Delete after sending?optionalSensitive emails (e.g. with password links or similar) can be deleted automatically from the email log after sending
Active?optionalActivates or deactivates the sending of the emails
VersandbedingungoptionalHere a rule block can be selected that is a dispatch condition deciding whether the email should be sent
Template test section
ID des Basis-BOoptionalIf a base BO is specified, an intid can be entered here for which the preview is created and the test email is sent
SpracheoptionalHere the language of the preview and the test email can be forced
Recipient of the test emailoptionalIf no recipient is specified, the email is sent to the Email redirection to address stored in the Nuclet parameter.
Create preview
Creates a preview in the tab Vorschau 
Sendet Test-E-Mail
For the final test, a test email can thus be sent
Configuration tab

Subject + messageoptional

Here subject and message can be defined. The following can be used

  • Any text
  • Data fields from the base BO in the form e.g. #{Auftragsnr} or #{Kunde.Kundengruppe.Name}. Available data fields can be found as help in the tab Available data fields  zu finden
  • Text blocks that are either not restricted to a BO (##{AGB}) or are allowed for the base BO (##{Ansprechpartner}), can be found as help in the tab Available text blocks 

Alternative texts in other languages can be specified for subject and message (see tab Subjects (translated) and Messages (translated))

Addresses taboptional

Wenn ein Recipients is specified, the email is sent to the email address determined there. Additionally or alternatively, further addresses can be added from

  • direkt angegebenen Adressen (z.B. CC info@firma.de)
  • a Nuclos user
  • all Nuclos users of a certain user group
  • an attribute of the base BO (or further referenced attributes, e.g. the email address of the person responsible for the sales order)
  • a Nuclet parameter
  • a block that is marked as E-Mail-Adresse gekennzeichnet ist
Attachments taboptional

Here attachments for the email can be defined, e.g.

  • a report or form 
  • a file stored in the template
  • a block that is marked as Anhang and for which the method getAttachments() returns a list of files

Alternative attachments in other languages can be defined for each attachment

State change taboptional

Here you can configure at which state change the email should be sent. However, a corresponding rule must be assigned for every possible state change of the affected state model. Helpful for this rule is then the method

EMailUtils.sendAllAcceptedEMails(StateChangeContext context, RegelBausteine regelBausteine)

Weitere
Description taboptionalFurther information for the template can be stored here
Reiter E-Mails
Shows the emails that have already been generated from this template

Use of email templates from version 1.1.3

Initialisierung

After the Nuclet import, the job Initialisiere Nuclet Emailversand must be run once.

Among other things, the job creates some standard email blocks so that you can build a template right away.

E-Mail-Template
An email template for an invoice could look like this, for example

Rechnungsformular als Anhang

Rule block for a recipient

The Regelbausteine interface
TextString getValue(String name, Modifiable<Long> bo, EMailTemplateSprache language, TemplateParameters parameters, RuleContext context)
AttachmentsList<NuclosFile> getAttachments(String name, Modifiable<Long> bo, EMailTemplateSprache language, TemplateParameters parameters)
RecipientsTemplateRecipient getRecipient(String name, Modifiable<Long> bo, EMailTemplateSprache language, TemplateParameters parameters)
SpracheNuclosLocale getLocale(EMailTemplateSprache langugage)
Versandbedingung

boolean isSendMail(EMailTemplateBaustein versandbedingung, Modifiable<Long> bo)

Adresse des WebclientsString getWebclientAddress()
AnredegetSalutation(User user, EMailTemplateSprache sprache)
Beispiel (Text)

public String getValue(final String name, final Modifiable<Long> bo, EMailTemplateSprache language, TemplateParameters parameters, RuleContext context) throws BusinessException {
if (SIGNATUR.equals(name)) {
return EMailHelper.getSignature();
} else if (RECHNUNGSPOSITIONEN.equals(name)) {
return EMailHelper.getRechnungspositionen(bo, parameters, name);
}
    throw new BusinessException("Unknown name for a rule block: \"" + name + "\"");
}
Example (recipient)

@Override
public TemplateRecipient getRecipient(String name, Modifiable<Long> bo, EMailTemplateSprache language, TemplateParameters parameters) throws BusinessException {
   if (ANSPRECHPARTNER.equals(name)) {
return EMailHelper.getTemplateRecipient(EMailHelper.getAnsprechpartner(bo, parameters, name));
} else if (BEARBEITER.equals(name)) {
return EMailHelper.getTemplateRecipient(EMailHelper.getBearbeiter(bo, name));
   throw new BusinessException("Unknown name for a recipient: \"" + name + "\"");
}
Beispiel (Verwendung in Regeln)
Simplest case
EMailTemplate template = EMailUtils.getEMailTemplate(Konstanten.EMailTemplate.RECHNUNG);
if (template.getAktiv()) {
EMailVersand.sendMail(new EMailContext(template, EMailUtils.getRegelBausteine(), rechnung, context));
}
Creation of templates (class EMailTemplateKonfiguration)

The class EMailTemplateKonfiguration provides data structures and methods to create languages, blocks and templates via rules.

This can be particularly helpful during Nuclet development, to recreate such objects on other instances.


Available data structures
  • Sprache
  • Baustein
  • Template
  • Restriction
  • Adresse
  • State change
  • Anhang
  • BausteinTranslation
  • AnhangTranslation
  • SubjectTranslation
  • MessageTranslation
Available methods for creation
  • EMailTemplate createTemplate(Template template, final JobContext context)
  • void createSprache(Sprache sprache, final JobContext context)
  • void insertBausteinTranslation(EMailTemplateBaustein baustein, BausteinTranslation translation)
  • void insertBausteinRestriction(EMailTemplateBaustein baustein, Restriction restriction)
  • EMailTemplateAnhang insertAnhang(EMailTemplate template, Anhang anhang)
  • void insertStatuswechsel(EMailTemplate template, Statuswechsel statuswechsel)
  • void insertAnhangTranslation(EMailTemplateAnhang anhang, AnhangTranslation translation)
  • void insertBetreffTranslation(EMailTemplate template, SubjectTranslation translation)
  • void insertNachrichtTranslation(EMailTemplate template, MessageTranslation translation)
  • void insertAdresse(EMailTemplate template, Adresse adresse)
  • EMailTemplateBaustein createBaustein(Baustein baustein, final JobContext context)
Beispiel (Konfiguration Baustein)
public static final EMailTemplateKonfiguration.Baustein FOOTER_INTERN = new EMailTemplateKonfiguration.Baustein() {{
setName(RegelBausteineImpl.Footer.FOOTER_INTERN);
setText("<br>\n<br>Many thanks and best regards,\n<br>\n<br>##{" + RegelBausteineImpl.Standard.AKTUELLER_BENUTZER + "}");
setFooter(true);
}};
Beispiel (Konfiguration Template)
public static final EMailTemplateKonfiguration.Template TEMPLATE_PROJEKT = new EMailTemplateKonfiguration.Template() {{
setName("Projekt aktiv");
setNuclet("org.nuclet.firma");
setAktiv(false);
setTable("Projekt");
setTestID(1234567);
setSpracheStatisch(EMailUtils.DEUTSCH);
setSubject("Neues Projekt");
setMessage("##{" + RegelBausteineImpl.Standard.ALLGEMEINE_ANREDE + "}" +
"\n<br>" +
"\n<br>the project #{@Nummer} has just been created.");
setFooter(RegelBausteineImpl.Footer.FOOTER_INTERN);
setSignature(RegelBausteineImpl.Signature.SIGNATUR);
addAddress(new EMailTemplateKonfiguration.Adresse() {{
setAttribute("Beauftragtdurch");
setAttributeRef("Emailbenutzer");
setPflichtfeld(true);
}});
}};
Creation example
EMailTemplateKonfiguration.createBaustein(FOOTER_INTERN, jobContext);
EMailTemplateKonfiguration.createTemplate(TEMPLATE_PROJEKT, jobContext);
Version 1.1.2

Beschreibung von Version 1.1.2

TopicDescription
E-Mail Umleitung

For test operation, email redirection can be activated. All outgoing emails are then redirected to a defined address.

The email additionally states to whom it would actually have gone.

E-Mail ProtokollAll emails to be sent and all sent emails are stored in the email log (under System) . Saving of the sent emails can be switched off in the Nuclet parameters.
E-Mail Queue

There are two different options for sending emails:

Send immediately

The email is sent immediately. If sending is triggered by a user (e.g. by a state change that triggers an email dispatch), they must wait until this process is complete before they can continue working. If an error occurs during email dispatch, the entire action (e.g. state change) of the user is undone.

Dispatch via email queue

The email is first stored in the email log as an unsent email and only sent by a regularly running job (Administration > Jobsteuerung > Versende Emails). This must of course be activated. This means the user is not held up unnecessarily long during their work, and a faulty email dispatch does not lead to the cancellation of their action.

E-Mail Empfang

The job EMailEmpfang creates an entry in the email log with the flags for new emails on the server specified in the IMAP system parameters Versendet = false, Empfangen = true, Verarbeitet = false.
The flag Verarbeitet can, after the successful further processing of the mail, be set to true be set.

Use in rulesDie Klasse EmailVersand stellt zwei Methoden bereit

Use in rule programming of version 1.1.2

Klasse EMailVersand
static void sendMail(EMailContext context)
Sends the email defined in the context
static void sendMailNow(EMailContext context)
Sends the email defined in the context immediately, regardless of the settings in the Nuclet parameters
Klasse EMailContext
void addRecipient(String address, int type)
Adds a recipient (type = To, CC or BCC)
void addRecipient(String address)
Adds a recipient (To)
void addRecipients(List<String> lRecipients, int type) 
Adds a list of recipients (type = To, CC or BCC)
void addRecipients(List<String> lRecipients)
Adds a list of recipients (To)
void addAttachment(NuclosFile file) 
Adds an attachment
void addAttachments(List<NuclosFile> lAttachments)
Adds a list of attachments
void setReplyTo(String replyTo)
Defines (reply address differing from the sender)
void setMessage(String message)
Defines the email message
void setSubject(String subject)
Defines the email subject
void setReference(String reference)
Defines a reference. This can be, for example, a sales order number. The reference has no influence on the email, but helps to find emails in the log that belong to a certain sales order.
void resetAttachments()
Clears the list of attachments
void resetRecipients()
Clears the list of recipients
Beispiel (E-Mail-Versand)

EMailContext context = new EMailContext();
context.addRecipient(auftrag.getKundeBO.getEmailadresse());
context.addRecipient("chef@firma.de", EMailContext.BCC);
context.addAttachment(auftrag.getRechnung());
context.setSubject("Invoice for order " + auftrag.getAuftragsnr());
context.setMessage("...");
context.setReplyTo("kundenservice@firma.de");
context.setReference(auftrag.getKundeBO().getKundennr());
EMailVersand.sendMail(context);
Beispiel (E-Mail-Empfang)

Query<EMailProtokoll> query = QueryProvider.create(EMailProtokoll.class);
query.where(EMailProtokoll.Empfangen.eq(Boolean.TRUE));
query.where(EMailProtokoll.Empfangeneemailverarbeitet.eq(Boolean.FALSE));
for (EMailProtokoll email : QueryProvider.execute(query)) {
process(email, context);
email.setEmpfangeneemailverarbeitet(Boolean.TRUE);
email.save();
}

Integration

The integration after a successful Nuclet import (see Nuclet Import) is to be carried out as follows.

StepDescriptionScreenshot
1

Configure the Nuclos parameters for using the MailProvider in Nuclos (under Administration > Parameter): 

  • SMTP Authentication
  • SMTP Username
  • SMTP Password
  • SMTP Server
  • SMTP Sender

See also Parameter für Mailversand.

2

Configure the Nuclet parameters of the Nuclets Emailversand (under Configuration > Nuclet Management)

NameDescription

Email Absender

Sender of the emails
Email Betreff PrefixOptional prefix for the subject line of all Nuclos mails (OFF = no prefix)
Email Nachricht AbschlussOptional closing formula of the message (OFF = no closing)
Email Nachricht SignaturOptional signature of the message (OFF = no signature)
Email sofort versendenEmails are sent immediately and not buffered in the email queue (Y/N)
Email UmleitungAll emails are redirected (Y/N)
Email redirection toTarget of the redirection
Versendete Emails löschenDelete successfully sent emails from the email log
Empfangene Emails löschenReceived emails are deleted from the mail server

Version 1.1.0

Integration / Beschreibung von Version 1.1.0

The integration after a successful Nuclet import (see Nuclet Import) is to be carried out as follows.

StepDescription
1

Konfigurieren Sie die, für die Nutzung des MailProviders in Nuclos erforderlichen, SMTP-Systemparameter (mindestens SMTP Authentication, SMTP Username, SMTP Password, SMTP Server, SMTP Sender). Siehe dazu auch Parameter für Mailversand.

2

Configure the From/ReplyTo address to be set by Nuclos in the Nuclet parameter "Email Sender Address". Furthermore, activate or deactivate the redirection as desired in the Nuclet parameters "Email Forwarding" ("Y" or "N") and "Email Forwarding Address". If the redirection is activated, all emails sent via this Nuclet are not sent to the actual recipient, but redirected to the address specified in "Email Forwarding Address". In this way, the implementation of automatically sent emails in your own Nuclet can be tested easily, or a test system can be configured easily so that it does not send any emails to your customers or suppliers.

3Adapt the signature to be used in the class EMailSignatur to your requirements.
4

Use the newly gained functionality by sending emails e.g. to your customers and suppliers. The following methods are available for this:

EMailVersand.sendEmail(String sRecipient, String sSubject, String sMessage, NuclosFile attachment, String lang)
EMailVersand.sendEmail(List<String> lRecipient, String sSubject, String sMessage, NuclosFile attachment, String lang)
EMailVersand.sendEmail(List<String> lRecipient, List<String> lRecipientCC, List<String> lRecipientBCC, String sSubject, String sMessage,
List<NuclosFile> lAttachment, String lang)

Emails sent via these methods are stored and archived under the menu item System | E-Mail-Protokoll. Remember to grant your users read permission for this menu item if necessary.

Example:

String sSubject = "Your invoice";
String sMessage = "Please find your invoice attached";
(new EMailVersand()).sendEmail(kunde.getEmailadresse(), sSubject, sMessage, pdfInvoice, "de");

Related pages

open book Modules


All modules

Open →

open book Nuclet Wiki


Nuclet Wiki home

Open →

  • Keine Stichwörter