diff --git a/extensions/Squidex.Extensions/Actions/Email/EmailAction.cs b/extensions/Squidex.Extensions/Actions/Email/EmailAction.cs index f2af64af8..0de1cb24f 100644 --- a/extensions/Squidex.Extensions/Actions/Email/EmailAction.cs +++ b/extensions/Squidex.Extensions/Actions/Email/EmailAction.cs @@ -15,28 +15,28 @@ namespace Squidex.Extensions.Actions.Email IconImage = "", IconColor = "#333300", Display = "Send an email", - Description = "Send an email", + Description = "Send an email with a custom SMTP server.", ReadMore = "https://en.wikipedia.org/wiki/Email")] - public class EmailAction : RuleAction + public sealed class EmailAction : RuleAction { [Required] - [Display(Name = "ServerHost", Description = "The Name or IP address of the host used for SMTP transactions.")] + [Display(Name = "ServerHost", Description = "The IP address or host to the SMTP server.")] public string ServerHost { get; set; } [Required] - [Display(Name = "ServerPort", Description = "The port to be used on host.")] + [Display(Name = "ServerPort", Description = "The port to the SMTP server.")] public int ServerPort { get; set; } [Required] - [Display(Name = "ServerUseSsl", Description = "Specify whether the smtp client uses Secure Sockets Layer (SSL) to encrypt the connection.")] + [Display(Name = "ServerUseSsl", Description = "Specify whether the SMPT client uses Secure Sockets Layer (SSL) to encrypt the connection.")] public bool ServerUseSsl { get; set; } [Required] - [Display(Name = "ServerUsername", Description = "The username used to authenticate the sender.")] + [Display(Name = "ServerUsername", Description = "The username for the SMTP server.")] public string ServerUsername { get; set; } [Required] - [Display(Name = "ServerPassword", Description = "The password used to authenticate the sender.")] + [Display(Name = "ServerPassword", Description = "The password for the SMTP server.")] public string ServerPassword { get; set; } [Required] diff --git a/extensions/Squidex.Extensions/Actions/Email/EmailActionHandler.cs b/extensions/Squidex.Extensions/Actions/Email/EmailActionHandler.cs index f15e8a90e..c05895634 100644 --- a/extensions/Squidex.Extensions/Actions/Email/EmailActionHandler.cs +++ b/extensions/Squidex.Extensions/Actions/Email/EmailActionHandler.cs @@ -6,22 +6,16 @@ // ========================================================================== using System; -using System.Collections.Generic; using System.Net; using System.Net.Mail; -using System.Text; using System.Threading.Tasks; -using Microsoft.Extensions.Options; using Squidex.Domain.Apps.Core.HandleRules; using Squidex.Domain.Apps.Core.HandleRules.EnrichedEvents; -using Squidex.Infrastructure; namespace Squidex.Extensions.Actions.Email { public sealed class EmailActionHandler : RuleActionHandler { - private const string Description = "Send an Email"; - public EmailActionHandler(RuleEventFormatter formatter) : base(formatter) { @@ -42,7 +36,9 @@ namespace Squidex.Extensions.Actions.Email MessageBody = Format(action.MessageBody, @event) }; - return (Description, ruleJob); + var description = $"Send an email to {action.MessageTo}"; + + return (description, ruleJob); } protected override async Task<(string Dump, Exception Exception)> ExecuteJobAsync(EmailJob job) @@ -56,6 +52,7 @@ namespace Squidex.Extensions.Actions.Email { message.Subject = job.MessageSubject; message.Body = job.MessageBody; + await client.SendMailAsync(message); } } @@ -64,12 +61,12 @@ namespace Squidex.Extensions.Actions.Email } } - public class EmailJob + public sealed class EmailJob { - public string ServerHost { get; set; } - public int ServerPort { get; set; } + public string ServerHost { get; set; } + public string ServerUsername { get; set; } public string ServerPassword { get; set; } diff --git a/src/Squidex.Domain.Apps.Entities/Schemas/Guards/GuardSchema.cs b/src/Squidex.Domain.Apps.Entities/Schemas/Guards/GuardSchema.cs index 820bf7b21..31237a2ed 100644 --- a/src/Squidex.Domain.Apps.Entities/Schemas/Guards/GuardSchema.cs +++ b/src/Squidex.Domain.Apps.Entities/Schemas/Guards/GuardSchema.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; diff --git a/src/Squidex/app/features/rules/pages/rules/actions/email-action.component.html b/src/Squidex/app/features/rules/pages/rules/actions/email-action.component.html index b63253994..c083bb1cc 100644 --- a/src/Squidex/app/features/rules/pages/rules/actions/email-action.component.html +++ b/src/Squidex/app/features/rules/pages/rules/actions/email-action.component.html @@ -8,7 +8,7 @@ - The Name or IP address of the host used for SMTP transactions. + The IP address or host to the SMTP server. @@ -19,10 +19,10 @@
- + - The port to be used on host. + The port to the SMTP server.
@@ -36,7 +36,7 @@ - Specify whether the smtp client uses Secure Sockets Layer (SSL) to encrypt the connection. + Specify whether the SMTP client uses Secure Sockets Layer (SSL) to encrypt the connection. @@ -50,7 +50,7 @@ - The username used to authenticate the sender. Read the help section for information about advanced formatting. + The username for the SMTP server. @@ -64,7 +64,7 @@ - The password used to authenticate the sender. + The password for the SMTP server. @@ -78,7 +78,7 @@ - The email sending address. Read the help section for information about advanced formatting. + The email sending address. Read the help section for information about advanced formatting. @@ -92,7 +92,7 @@ - The email message will be sent to. Read the help section for information about advanced formatting. + The email message will be sent to. Read the help section for information about advanced formatting. diff --git a/src/Squidex/app/features/rules/pages/rules/actions/email-action.component.ts b/src/Squidex/app/features/rules/pages/rules/actions/email-action.component.ts index 401d49315..31761bef8 100644 --- a/src/Squidex/app/features/rules/pages/rules/actions/email-action.component.ts +++ b/src/Squidex/app/features/rules/pages/rules/actions/email-action.component.ts @@ -31,8 +31,7 @@ export class EmailActionComponent implements OnInit { this.actionForm.setControl('serverPort', new FormControl(this.action.serverPort || 465, [ - Validators.required, - Validators.pattern(/\d{2,6}/) + Validators.required ])); this.actionForm.setControl('serverUseSsl', diff --git a/src/Squidex/app/features/rules/pages/rules/rule-element.component.html b/src/Squidex/app/features/rules/pages/rules/rule-element.component.html index 0ed7ed462..84f66d156 100644 --- a/src/Squidex/app/features/rules/pages/rules/rule-element.component.html +++ b/src/Squidex/app/features/rules/pages/rules/rule-element.component.html @@ -25,7 +25,7 @@ diff --git a/tests/Squidex.Tests/Pipeline/ETagFilterTests.cs b/tests/Squidex.Tests/Pipeline/ETagFilterTests.cs index 6e923b253..ec1ca4bfe 100644 --- a/tests/Squidex.Tests/Pipeline/ETagFilterTests.cs +++ b/tests/Squidex.Tests/Pipeline/ETagFilterTests.cs @@ -7,7 +7,6 @@ using System.Collections.Generic; using System.Threading.Tasks; -using FakeItEasy; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Abstractions;