The specific use case is the request to send reminder emails in TLContract:
Either: For all contracts, if the contract has one of the statuses green, yellow or red, send an email for this contract to the contract owner.
Or: For all contract owners, find all contracts with the status green, yellow or red for this contract owner and send an email with an ordered list of these contracts to the contract owner.
General: It should be possible to send emails from an application, e.g. as a "Scheduled Task". The email content (subject, body) should be determined by evaluating template expressions in the context of a business model. It should be possible to transfer the email recipients as an email address and/or account or contact.
Furthermore, it should be possible to (optionally) specify the message type and text encoding. It should also be possible to send documents as attachments.
Application
sendMail( subject: "Hello world!", to: "Mr. Foobar <foo@bar.de>", cc: ["hello@kitty.com", "bar@foo.de"], bcc: "hidden@local.com", body: {{ <h1>Hello {$receiver}<h1> <p>...</p> }}}, attachments: [ binary(...), { "id": "abc", "data": binary(...) } ] )
Code migration
Typo fixed in various APIs: Attachment is called attachment.
Data migration
Typo in the model fixed: Attachment is called attachment. Data migration happens automatically.
Test
Send a mail from the script console.