Email Activity And SMTP Server Setup - NeoSOFT-Technologies/workflow-plugins GitHub Wiki
Description
The Send Email Activity enables you to send email from a Workflow. Before the e-mail message is sent, the code in the Send Email Activity validates that the e-mail and SMTP properties are set correctly.
Email activity has the following settings:
- From
- To
- Subject
- Body
- Attachments
NuGet Package
We need to install Elsa.Activities.Email package from NuGet Package Manager to use Email Activity. This package provides the SendEmail activity.
We need to add AddEmailActivities in Startup.cs file as shown below,
services
.AddElsa(elsa => elsa
.AddEmailActivities(elsaSection.GetSection("Smtp").Bind)
);
We need to provide Smtp Host and Port in appsetting.json file as shown below,
"Elsa": {
"Smtp": {
"Host": "localhost",
"Port": "2525"
},
}
Add SendEmail Activity in workflow as shown below,
Properties of SendEmail activity,
Run below command in Command Prompt to get the smtp docker email image at localhost:3000 webpage,
docker run --rm -it -p 3000:80 -p 2525:25 rnwood/smtp4dev
The Smtp Server will be seen as below,