parent
8145e847e9
commit
31d24034d1
|
|
@ -85,6 +85,12 @@ services:
|
|||
- "5601:5601"
|
||||
depends_on:
|
||||
- elasticsearch
|
||||
|
||||
smtp4dev:
|
||||
image: rnwood/smtp4dev:3.1.3-ci20211206101
|
||||
ports:
|
||||
- "3000:80"
|
||||
- "2525:25"
|
||||
|
||||
networks:
|
||||
consul:
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\bundles\Elsa\Elsa.csproj" />
|
||||
<ProjectReference Include="..\..\modules\Elsa.Email\Elsa.Email.csproj" />
|
||||
<ProjectReference Include="..\..\modules\Elsa.Hangfire\Elsa.Hangfire.csproj" />
|
||||
<ProjectReference Include="..\..\modules\Elsa.Http\Elsa.Http.csproj" />
|
||||
<ProjectReference Include="..\..\modules\Elsa.Identity\Elsa.Identity.csproj" />
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ services
|
|||
.UseJavaScript()
|
||||
.UseLiquid()
|
||||
.UseHttp()
|
||||
.UseEmail(email => email.ConfigureOptions = options => configuration.GetSection("Smtp").Bind(options))
|
||||
);
|
||||
|
||||
services.AddHealthChecks();
|
||||
|
|
|
|||
|
|
@ -17,5 +17,10 @@
|
|||
"Tokens": {
|
||||
"SigningKey": "secret-signing-key"
|
||||
}
|
||||
},
|
||||
"Smtp": {
|
||||
"Host": "localhost",
|
||||
"Port": 2525,
|
||||
"DefaultSender": "noreply@crmservices.com"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\modules\Elsa.Elasticsearch\Elsa.Elasticsearch.csproj" />
|
||||
<ProjectReference Include="..\..\modules\Elsa.Email\Elsa.Email.csproj" />
|
||||
<ProjectReference Include="..\..\modules\Elsa.EntityFrameworkCore.PostgreSql\Elsa.EntityFrameworkCore.PostgreSql.csproj" />
|
||||
<ProjectReference Include="..\..\modules\Elsa.EntityFrameworkCore.Sqlite\Elsa.EntityFrameworkCore.Sqlite.csproj" />
|
||||
<ProjectReference Include="..\..\modules\Elsa.EntityFrameworkCore\Elsa.EntityFrameworkCore.csproj" />
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ services
|
|||
.UseJavaScript()
|
||||
.UseLiquid()
|
||||
.UseHttp()
|
||||
.UseEmail(email => email.ConfigureOptions = options => configuration.GetSection("Smtp").Bind(options))
|
||||
);
|
||||
|
||||
services.Configure<JintOptions>(options => options.AllowClrAccess = true);
|
||||
|
|
|
|||
|
|
@ -15,6 +15,11 @@
|
|||
"ConnectionStrings": {
|
||||
"Sqlite": "Data Source=elsa.sqlite.db;Cache=Shared;"
|
||||
},
|
||||
"Smtp": {
|
||||
"Host": "localhost",
|
||||
"Port": 2525,
|
||||
"DefaultSender": "noreply@crmservices.com"
|
||||
},
|
||||
"Identity": {
|
||||
"Tokens": {
|
||||
"SigningKey": "secret-signing-key",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
using System.Collections;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using Elsa.Email.Contracts;
|
||||
using Elsa.Email.Models;
|
||||
using Elsa.Email.Options;
|
||||
|
|
@ -20,11 +22,22 @@ namespace Elsa.Email.Activities;
|
|||
[Activity("Email", "Send an email message.", Kind = ActivityKind.Task)]
|
||||
public class SendEmail : Activity
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public SendEmail([CallerFilePath] string? source = default, [CallerLineNumber] int? line = default) : base(source, line)
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[JsonConstructor]
|
||||
public SendEmail()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The sender's email address.
|
||||
/// </summary>
|
||||
[Input(Description = "The sender's email address.")]
|
||||
public Input<string?> From { get; set; }
|
||||
public Input<string?> From { get; set; } = default!;
|
||||
|
||||
[Input(Description = "The recipients email addresses.", UIHint = InputUIHints.MultiText)]
|
||||
public Input<ICollection<string>> To { get; set; } = default!;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using Elsa.Email.Contracts;
|
||||
using Elsa.Email.Options;
|
||||
using Elsa.Email.Services;
|
||||
using Elsa.Extensions;
|
||||
using Elsa.Features.Abstractions;
|
||||
using Elsa.Features.Services;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
|
@ -27,11 +28,18 @@ public class EmailFeature : FeatureBase
|
|||
/// </summary>
|
||||
public Action<IServiceProvider, HttpClient> ConfigureDownloaderHttpClient { get; set; } = (_, _) => { };
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Configure()
|
||||
{
|
||||
Module.AddActivitiesFrom<EmailFeature>();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Apply()
|
||||
{
|
||||
Services.Configure(ConfigureOptions);
|
||||
Services.AddSingleton<ISmtpService, MailKitSmtpService>();
|
||||
Services.AddHttpClient<IDownloader, DefaultDownloader>(ConfigureDownloaderHttpClient);
|
||||
Services
|
||||
.Configure(ConfigureOptions)
|
||||
.AddSingleton<ISmtpService, MailKitSmtpService>()
|
||||
.AddHttpClient<IDownloader, DefaultDownloader>(ConfigureDownloaderHttpClient);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
version: '3.9'
|
||||
|
||||
services:
|
||||
|
||||
smtp4dev:
|
||||
image: rnwood/smtp4dev:3.1.3-ci20211206101
|
||||
ports:
|
||||
- "3000:80"
|
||||
- "2525:25"
|
||||
|
||||
volumes:
|
||||
mssql-azuresql-edge-data:
|
||||
Loading…
Reference in a new issue