-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* docs: add english doc for email service * docs: add norwegian doc for Email * docs: refactor email docs after review comments * docs: refactor email docs after review comments for the en-docs --------- Co-authored-by: HauklandJ <[email protected]> Co-authored-by: Eirik Mikkelsen <[email protected]>
- Loading branch information
1 parent
ba15fb9
commit e258041
Showing
2 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
title: Email | ||
description: How to create custom email notifications for apps. | ||
weight: 400 | ||
--- | ||
|
||
## Activate generation of email notifications in your application | ||
|
||
The email client is automatically added to the application. To use it, inject the `IEmailNotificationClient`-interface. The interface defines a method used to order an email notification from the [Altinn Notifications](https://github.com/Altinn/altinn-notifications) API. | ||
|
||
### Code example | ||
```csharp | ||
using Altinn.App.Core.Internal.Email; | ||
using Altinn.App.Core.Models.Email; | ||
using Altinn.Platform.Storage.Interface.Models; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
|
||
namespace Altinn.App.Custom; | ||
|
||
public class CustomEmailClass(IEmailNotificationClient emailNotificationClient) | ||
{ | ||
private readonly IEmailNotificationClient _emailNotificationClient = emailNotificationClient; | ||
|
||
public async Task OrderEmail(string subject, string body, List<EmailRecipient> emailRecipients, string sendersReference) | ||
{ | ||
var emailNotification = new EmailNotification(subject, body, emailRecipients, sendersReference); | ||
var emailOrderResponse = await _emailNotificationClient.Order(emailNotification, new System.Threading.CancellationToken()); | ||
... | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
title: E-post | ||
description: Hvordan opprette egendefinerte e-postvarslinger for apper. | ||
weight: 400 | ||
--- | ||
|
||
## Aktiver generering av e-postvarslinger i applikasjonen din | ||
|
||
E-postklienten legges automatisk til i applikasjonen. For å bruke den, injiser `IEmailNotificationClient`-interface. IEmailNotificationClient definerer en metode som brukes til å bestille en e-postvarsling fra [Altinn Notifications](https://github.com/Altinn/altinn-notifications) API. | ||
|
||
### Kodeeksempel | ||
```csharp | ||
using Altinn.App.Core.Internal.Email; | ||
using Altinn.App.Core.Models.Email; | ||
using Altinn.Platform.Storage.Interface.Models; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
|
||
namespace Altinn.App.Custom; | ||
|
||
public class CustomEmailClass(IEmailNotificationClient emailNotificationClient) | ||
{ | ||
private readonly IEmailNotificationClient _emailNotificationClient = emailNotificationClient; | ||
|
||
public async Task OrderEmail(string subject, string body, List<EmailRecipient> emailRecipients, string sendersReference) | ||
{ | ||
var emailNotification = new EmailNotification(subject, body, emailRecipients, sendersReference); | ||
var emailOrderResponse = await _emailNotificationClient.Order(emailNotification, new System.Threading.CancellationToken()); | ||
... | ||
} | ||
} | ||
``` |