Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure Email Communication Services (Lombiq Technologies: OCORE-129) #14749

Closed
wants to merge 147 commits into from
Closed
Show file tree
Hide file tree
Changes from 131 commits
Commits
Show all changes
147 commits
Select commit Hold shift + click to select a range
22f80fd
Support email through Azure Communicaton Services
hishamco Nov 17, 2023
3db73e8
Options -> Settings
hishamco Nov 23, 2023
99b596c
Add NullEmailService for testing purpose
hishamco Nov 23, 2023
ac8fbc3
Fix broken unit test
hishamco Nov 23, 2023
31a41fc
Add OC.Email.Azure module
hishamco Nov 23, 2023
f15812a
Split the email settings from SMTP email settings
hishamco Nov 23, 2023
05180af
Fix ConnectionString configuration message
hishamco Nov 23, 2023
40462d4
Enable OC.Email.Smtp feature on ComingSoon recipe
hishamco Nov 23, 2023
71d9f94
Get the default sender from EmailSettings
hishamco Nov 23, 2023
ace3bc0
Add ConfigureAzureEmailSettings() extension method
hishamco Nov 23, 2023
1acd3f3
OC.Email.Azure should depends on OC.Email
hishamco Nov 24, 2023
73d4230
Add docs
hishamco Nov 24, 2023
f625248
Merge branch 'main' into hishamco/email-azure
hishamco Nov 24, 2023
8fd62a7
Should inherits from EmailServiceBase
hishamco Nov 24, 2023
29c6c61
Add unit test
hishamco Nov 24, 2023
673acf1
Fix TEmailService for NullEmailService
hishamco Nov 24, 2023
da600dd
SmtpSettings -> SmtpEmailSettings
hishamco Nov 24, 2023
8cdc83d
Don't check the DefaultSender from within SmtpEmailSettings
hishamco Nov 24, 2023
c5b5fb2
Should get SmtpEmailService instance while testing SMTP settings
hishamco Nov 24, 2023
22c3990
mkdocs-material 9.4.12
agriffard Nov 24, 2023
7efda9b
Fix merge conflict
hishamco Nov 24, 2023
cc511c3
Merge branch 'main' into hishamco/email-azure
hishamco Nov 27, 2023
385666b
Use keyed service
hishamco Nov 27, 2023
c19911f
Add other email properties
hishamco Nov 27, 2023
80d8304
Refactoring
hishamco Dec 1, 2023
b536600
Register NullEmailService
hishamco Dec 1, 2023
83487c2
Split OC.Email.Smtp into another module
hishamco Dec 1, 2023
040e7df
Merge remote-tracking branch 'origin/main' into hishamco/email-azure
hishamco Dec 1, 2023
e34e8d0
Fix the build
hishamco Dec 1, 2023
253cf27
Attach supported mime types
hishamco Dec 1, 2023
aafb266
Use primary constrcutor
hishamco Dec 1, 2023
e0fb3f3
MailRecipients -> MailMessageRecipients
hishamco Dec 1, 2023
7142247
Merge remote-tracking branch 'origin/main' into hishamco/email-azure
hishamco Dec 1, 2023
458072e
Revert changes from ServiceDescriptorExtensions
hishamco Dec 1, 2023
ef4a8bc
Merge remote-tracking branch 'origin/main' into hishamco/email-azure
hishamco Dec 11, 2023
93ed350
Remove keyed service
hishamco Dec 16, 2023
1ebde44
Merge remote-tracking branch 'origin/main' into hishamco/email-azure
hishamco Dec 20, 2023
36f8977
Use application/xml instead of text/xml
hishamco Dec 20, 2023
b81fc21
ccRecipients -> bccRecipients
hishamco Dec 20, 2023
2e40baa
Reorder the modifiers
hishamco Dec 20, 2023
7d378ae
Merge branch 'main' into hishamco/email-azure
hishamco Jan 3, 2024
53ceb20
Update src/OrchardCore.Modules/OrchardCore.Email.Smtp/Drivers/SmtpSet…
hishamco Jan 11, 2024
2716e83
Update src/OrchardCore.Modules/OrchardCore.Email.Smtp/Drivers/SmtpSet…
hishamco Jan 11, 2024
3037a91
Update src/OrchardCore/OrchardCore.Email.Core/Services/SmtpEmailServi…
hishamco Jan 11, 2024
cb8debb
Update src/OrchardCore.Modules/OrchardCore.Email.Azure/Services/Azure…
hishamco Jan 11, 2024
a607841
Update src/docs/reference/README.md
hishamco Jan 11, 2024
3aa1348
Update src/OrchardCore.Modules/OrchardCore.Email/Views/EmailSettings.…
hishamco Jan 11, 2024
e530d3d
Update src/OrchardCore/OrchardCore.Email.Core/Services/NullEmailServi…
hishamco Jan 11, 2024
0c93928
Update src/OrchardCore/OrchardCore.Email.Core/Services/SmtpEmailServi…
hishamco Jan 11, 2024
b58a9ff
Merge branch 'main' into hishamco/email-azure
hishamco Jan 11, 2024
957faa1
Move Microsoft.Extensions.Diagnostics.Testing to Dependencies
hishamco Jan 11, 2024
2ae0940
Address feedback
hishamco Jan 11, 2024
5e0d6e4
Fix doc
hishamco Jan 11, 2024
45e595e
Merge branch 'main' into hishamco/email-azure
hishamco Jan 11, 2024
eeacb04
Address feedback
hishamco Jan 15, 2024
2a7c24f
Fix the build
hishamco Jan 15, 2024
906baa0
Introduce EmailDeliveryService(s)
hishamco Jan 18, 2024
da7e1aa
Remove email services
hishamco Jan 18, 2024
3296011
Use file-scope namespaces
hishamco Jan 18, 2024
70c4017
Fix the broken test
hishamco Jan 18, 2024
6114f50
Modify the docs
hishamco Jan 18, 2024
a604ee6
Add release note
hishamco Jan 18, 2024
9bc4808
Add hint in SmtpEmailSettings.Edit.cshtml
hishamco Jan 18, 2024
1573d7f
Merge branch 'main' into hishamco/email-azure
hishamco Jan 18, 2024
9dd9c7e
Merge branch 'main' into hishamco/email-azure
hishamco Jan 23, 2024
0fb87c6
Split SMTP settings from email settings
hishamco Jan 18, 2024
96ec593
Split azure email mime types into another file for clarity
hishamco Jan 18, 2024
8fa8fba
AddEmailServices()
hishamco Jan 20, 2024
5aac300
Use keyed services
hishamco Jan 21, 2024
7971126
Add EmailDeliveryServiceResolver
hishamco Jan 23, 2024
67dd7e9
Merge branch 'main' into hishamco/email-azure
hishamco Jan 23, 2024
e2b25d2
Fix the build
hishamco Jan 23, 2024
dbb99b7
Formatting
hishamco Jan 24, 2024
1d40a82
Enable OC.Email by OC.Email.Smtp or OC.Email.Azure
hishamco Jan 24, 2024
6932ab4
Update src/docs/reference/modules/Email.Azure/README.md
hishamco Jan 28, 2024
bf482eb
Update src/docs/reference/modules/Email.Smtp/README.md
hishamco Jan 28, 2024
2a6878e
Update src/OrchardCore.Modules/OrchardCore.Email.Azure/Services/Azure…
hishamco Jan 28, 2024
03d9aca
Update src/OrchardCore/OrchardCore.Email.Abstractions/Services/IEmail…
hishamco Jan 28, 2024
a0a5940
Merge branch 'main' into hishamco/email-azure
hishamco Jan 28, 2024
81efd07
deliveryServiceName -> deliveryMethodName
hishamco Jan 28, 2024
40c7be3
Fix the removed key
hishamco Jan 28, 2024
85c65af
Refer to the docs
hishamco Jan 28, 2024
4770bf4
Remove IEmailMessageValidator from AdminController
hishamco Jan 28, 2024
e318063
Update src/docs/reference/modules/Email.Smtp/README.md
hishamco Jan 28, 2024
db131a0
Update src/docs/reference/modules/Email/README.md
hishamco Jan 28, 2024
a2e09e2
Log warning in NullEmailDeliveryService
hishamco Jan 29, 2024
3f7a69f
Add additional notes to the release notes
hishamco Jan 29, 2024
727e0ad
Move _allowedMimeTypes back to the base class
hishamco Jan 29, 2024
a11d223
Fix log error message
hishamco Jan 29, 2024
112bad5
Use more descriptive name
hishamco Jan 29, 2024
5fbb570
Fix localized message
hishamco Jan 29, 2024
049926e
Fix broken test
hishamco Jan 29, 2024
bbbb145
Validate() -> IsValidate()
hishamco Jan 29, 2024
40d7fdc
Update src/docs/releases/1.9.0.md
hishamco Jan 29, 2024
b8c0f81
Update src/OrchardCore/OrchardCore.Email.Core/Services/EmailMessageVa…
hishamco Jan 29, 2024
573f8fe
Remove EmailDeliveryServiceName from abstraction project
hishamco Jan 29, 2024
c2efdfe
submitterAddress -> senderAddress
hishamco Jan 29, 2024
9fbbfac
Move IEmailDeliveryServiceResolver to OC.Email.Services namespace
hishamco Jan 29, 2024
5931737
Add IEmailServiceEvents
hishamco Jan 29, 2024
627490d
Fix test
hishamco Jan 29, 2024
7a7d9c1
Split tests
hishamco Jan 29, 2024
46c5fda
Add Azure Email module docs in release notes
hishamco Jan 29, 2024
a14ade8
Simplify resolving keyed services
hishamco Jan 29, 2024
57d787a
IsValidate() -> IsValid()
hishamco Jan 29, 2024
f08c246
Fix the build
hishamco Jan 29, 2024
e52e895
Fix EmailDeliveryServiceResolver
hishamco Jan 29, 2024
09105ce
Update test/OrchardCore.Tests/Modules/OrchardCore.Email/EmailValidato…
hishamco Jan 30, 2024
361e326
Update src/OrchardCore/OrchardCore.Email.Core/Services/NullEmailDeliv…
hishamco Jan 30, 2024
c7fc3c9
Update src/docs/releases/1.9.0.md
hishamco Jan 30, 2024
2acfe6e
Update src/OrchardCore.Modules/OrchardCore.Email.Azure/Manifest.cs
hishamco Jan 30, 2024
778f560
deliveryMethodName -> deliveryServiceName
hishamco Jan 30, 2024
592f436
sender -> recipient
hishamco Jan 30, 2024
3950960
Fix SmtpEmailSettingsConfiguration
hishamco Jan 30, 2024
505813f
SMTP configuration should be backward compatible
hishamco Feb 1, 2024
e0fcd4b
NullEmailDeliveryService should fail when deliver an email
hishamco Feb 1, 2024
ab5183b
Add note for backward compatibility
hishamco Feb 1, 2024
760d520
Merge branch 'main' into hishamco/email-azure
hishamco Feb 1, 2024
d6f3d39
Fix the build
hishamco Feb 1, 2024
7cc40d0
Simplify resolving EmailDeliveryServiceResolver
hishamco Feb 1, 2024
69566e5
Add migration process to the release notes
hishamco Feb 1, 2024
64a070a
Fix the email menu
hishamco Feb 1, 2024
fb11fae
Introduce IEmailResult
hishamco Feb 1, 2024
42ccee8
Merge branch 'main' into hishamco/email-azure
hishamco Feb 1, 2024
58ec136
Update src/docs/releases/1.9.0.md
hishamco Feb 1, 2024
2f39c0e
Update src/OrchardCore.Modules/OrchardCore.Email.Azure/Views/Admin/Op…
hishamco Feb 1, 2024
2c22f1f
Update src/OrchardCore.Modules/OrchardCore.Email.Smtp/Views/SmtpEmail…
hishamco Feb 1, 2024
8283a70
Comment the settings
hishamco Feb 1, 2024
7791c2b
Remove unnecessary lines
hishamco Feb 1, 2024
75365fd
Remove SMTP keys from email section
hishamco Feb 1, 2024
636a1f4
Add new modules to mkdocs.yml
hishamco Feb 1, 2024
2df5c43
Merge branch 'main' into hishamco/email-azure
hishamco Feb 1, 2024
6309a81
Add video to the docs
hishamco Feb 2, 2024
98c53a9
Merge branch 'main' into hishamco/email-azure
hishamco Feb 2, 2024
ac8d13c
Merge branch 'main' into hishamco/email-azure
hishamco Feb 2, 2024
4e40444
Merge branch 'main' into hishamco/email-azure
hishamco Feb 3, 2024
828757d
Apply suggestions from code review
hishamco Feb 3, 2024
c7f838e
Format admin menu & permissions
hishamco Feb 3, 2024
95131c4
Use constants
hishamco Feb 3, 2024
47e52db
Use protected
hishamco Feb 3, 2024
62b2155
Fix docs
hishamco Feb 3, 2024
ca86ef2
Use NavigationHelper
hishamco Feb 3, 2024
dbe443c
Save indentation
hishamco Feb 3, 2024
1153d45
Don't use nameof
hishamco Feb 3, 2024
62a46ca
Fix the log message
hishamco Feb 3, 2024
b5d9cd2
Use file-scope
hishamco Feb 3, 2024
d65d580
Merge branch 'main' into hishamco/email-azure
hishamco Feb 3, 2024
83aae0a
Remove unnecessary Order
hishamco Feb 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 16 additions & 2 deletions OrchardCore.sln
Original file line number Diff line number Diff line change
Expand Up @@ -427,8 +427,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OrchardCore.AuditTrail.Abst
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OrchardCore.AuditTrail", "src\OrchardCore.Modules\OrchardCore.AuditTrail\OrchardCore.AuditTrail.csproj", "{67509F89-E3D6-4FF9-98EC-A9519937A364}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OrchardCore.Email.Azure", "src\OrchardCore.Modules\OrchardCore.Email.Azure\OrchardCore.Email.Azure.csproj", "{91DD6469-20AE-4F94-AF49-C13E8FCA4343}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OrchardCore.Email.Core", "src\OrchardCore\OrchardCore.Email.Core\OrchardCore.Email.Core.csproj", "{D00CF459-396D-49C9-92E2-3FD3C2A59847}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OrchardCore.Email.Smtp", "src\OrchardCore.Modules\OrchardCore.Email.Smtp\OrchardCore.Email.Smtp.csproj", "{44BF04A1-5C0C-4773-9C1E-FE1013841857}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "OrchardCore", "OrchardCore", "{2BC850C3-9846-47E1-9068-AC0A8E5537AC}"
ProjectSection(SolutionItems) = preProject
src\OrchardCore\Directory.Build.props = src\OrchardCore\Directory.Build.props
Expand Down Expand Up @@ -511,9 +515,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OrchardCore.Search.AzureAI"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OrchardCore.Search.AzureAI.Core", "src\OrchardCore\OrchardCore.Search.AzureAI.Core\OrchardCore.Search.AzureAI.Core.csproj", "{E9428DE8-5D81-4359-BF84-31435041FF1A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OrchardCore.Media.Indexing.Pdf", "src\OrchardCore.Modules\OrchardCore.Media.Indexing.Pdf\OrchardCore.Media.Indexing.Pdf.csproj", "{95187E6A-5B74-4475-8FEB-758ACD012DCC}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OrchardCore.Media.Indexing.Pdf", "src\OrchardCore.Modules\OrchardCore.Media.Indexing.Pdf\OrchardCore.Media.Indexing.Pdf.csproj", "{95187E6A-5B74-4475-8FEB-758ACD012DCC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OrchardCore.Media.Indexing.OpenXML", "src\OrchardCore.Modules\OrchardCore.Media.Indexing.OpenXML\OrchardCore.Media.Indexing.OpenXML.csproj", "{47777735-7432-4CCA-A8C5-672E9EE65121}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OrchardCore.Media.Indexing.OpenXML", "src\OrchardCore.Modules\OrchardCore.Media.Indexing.OpenXML\OrchardCore.Media.Indexing.OpenXML.csproj", "{47777735-7432-4CCA-A8C5-672E9EE65121}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -1233,10 +1237,18 @@ Global
{67509F89-E3D6-4FF9-98EC-A9519937A364}.Debug|Any CPU.Build.0 = Debug|Any CPU
{67509F89-E3D6-4FF9-98EC-A9519937A364}.Release|Any CPU.ActiveCfg = Release|Any CPU
{67509F89-E3D6-4FF9-98EC-A9519937A364}.Release|Any CPU.Build.0 = Release|Any CPU
{91DD6469-20AE-4F94-AF49-C13E8FCA4343}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{91DD6469-20AE-4F94-AF49-C13E8FCA4343}.Debug|Any CPU.Build.0 = Debug|Any CPU
{91DD6469-20AE-4F94-AF49-C13E8FCA4343}.Release|Any CPU.ActiveCfg = Release|Any CPU
{91DD6469-20AE-4F94-AF49-C13E8FCA4343}.Release|Any CPU.Build.0 = Release|Any CPU
{D00CF459-396D-49C9-92E2-3FD3C2A59847}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D00CF459-396D-49C9-92E2-3FD3C2A59847}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D00CF459-396D-49C9-92E2-3FD3C2A59847}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D00CF459-396D-49C9-92E2-3FD3C2A59847}.Release|Any CPU.Build.0 = Release|Any CPU
{44BF04A1-5C0C-4773-9C1E-FE1013841857}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{44BF04A1-5C0C-4773-9C1E-FE1013841857}.Debug|Any CPU.Build.0 = Debug|Any CPU
{44BF04A1-5C0C-4773-9C1E-FE1013841857}.Release|Any CPU.ActiveCfg = Release|Any CPU
{44BF04A1-5C0C-4773-9C1E-FE1013841857}.Release|Any CPU.Build.0 = Release|Any CPU
{7F31D1A5-2B6F-448A-9337-482F876B85EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7F31D1A5-2B6F-448A-9337-482F876B85EF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7F31D1A5-2B6F-448A-9337-482F876B85EF}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -1556,7 +1568,9 @@ Global
{AB47A65C-7BA9-4CE7-BA73-285EB7A2CEFD} = {F23AC6C2-DE44-4699-999D-3C478EF3D691}
{442C544F-6587-4FA5-8459-710ED8492AD4} = {F23AC6C2-DE44-4699-999D-3C478EF3D691}
{67509F89-E3D6-4FF9-98EC-A9519937A364} = {A066395F-6F73-45DC-B5A6-B4E306110DCE}
{91DD6469-20AE-4F94-AF49-C13E8FCA4343} = {A066395F-6F73-45DC-B5A6-B4E306110DCE}
{D00CF459-396D-49C9-92E2-3FD3C2A59847} = {F23AC6C2-DE44-4699-999D-3C478EF3D691}
{44BF04A1-5C0C-4773-9C1E-FE1013841857} = {A066395F-6F73-45DC-B5A6-B4E306110DCE}
{2BC850C3-9846-47E1-9068-AC0A8E5537AC} = {184139CF-C4AB-4FBE-AE19-54C8B3FE5C5E}
{85EF279B-8F35-476D-9BBD-F503F20712B5} = {184139CF-C4AB-4FBE-AE19-54C8B3FE5C5E}
{21F459C1-494E-41C9-B221-6C102774A47F} = {184139CF-C4AB-4FBE-AE19-54C8B3FE5C5E}
Expand Down
2 changes: 2 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ nav:
- Core Modules:
- Audit Trail: docs/reference/modules/AuditTrail/README.md
- Auto Setup: docs/reference/modules/AutoSetup/README.md
- Azure Email: docs/reference/modules/Email.Azure/README.md
- Features: docs/reference/modules/Features/README.md
- Contents: docs/reference/modules/Contents/README.md
- Configuration: docs/reference/core/Configuration/README.md
Expand Down Expand Up @@ -229,6 +230,7 @@ nav:
- Security: docs/reference/modules/Security/README.md
- Setup: docs/reference/modules/Setup/README.md
- Shells: docs/reference/core/Shells/README.md
- SMTP Email: docs/reference/modules/Email.Smtp/README.md
- Tenants: docs/reference/modules/Tenants/README.md
- Workflows: docs/reference/modules/Workflows/README.md
- DataProtection (Azure Storage): docs/reference/modules/DataProtection.Azure/README.md
Expand Down
1 change: 1 addition & 0 deletions src/OrchardCore.Build/Dependencies.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<PackageManagement Include="AWSSDK.S3" Version="3.7.104.11" />
<PackageManagement Include="AWSSDK.Extensions.NETCore.Setup" Version="3.7.7" />
<PackageManagement Include="AWSSDK.SecurityToken" Version="3.7.101.60" />
<PackageManagement Include="Azure.Communication.Email" Version="1.0.1" />
<PackageManagement Include="Azure.Extensions.AspNetCore.Configuration.Secrets" Version="1.3.0" />
<PackageManagement Include="Azure.Extensions.AspNetCore.DataProtection.Blobs" Version="1.3.2" />
<PackageManagement Include="Azure.Identity" Version="1.10.4" />
Expand Down
39 changes: 23 additions & 16 deletions src/OrchardCore.Cms.Web/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,29 @@
// "BlobName": "", // Optional, defaults to Sites/tenant_name/DataProtectionKeys.xml. Templatable, refer docs.
// "CreateContainer": true // Creates the container during app startup if it does not already exist.
//},
//"OrchardCore_Email": {
// "DefaultSender": ""
//},
//"OrchardCore_Email_Azure": {
// "DefaultSender": "",
// "ConnectionString": "" // Set to your Azure Communication Service email connection string.
//},
//"OrchardCore_Email_Smtp": {
hishamco marked this conversation as resolved.
Show resolved Hide resolved
// "DefaultSender": "",
// "DeliveryMethod": "Network",
// "PickupDirectoryLocation": "",
// "Host": "localhost",
// "Port": 25,
// // Uncomment if SMTP server runs through a proxy server
// //"ProxyHost": "proxy.domain.com",
// //"ProxyPort": 5050,
// "EncryptionMethod": "SSLTLS",
// "AutoSelectEncryption": false,
// "UseDefaultCredentials": false,
// "RequireCredentials": true,
// "Username": "",
// "Password": ""
//},
// See https://docs.orchardcore.net/en/latest/docs/reference/modules/Markdown/#markdown-configuration
//"OrchardCore_Markdown": {
// "Extensions": "nohtml+advanced"
Expand Down Expand Up @@ -201,22 +224,6 @@
//"OrchardCore_HealthChecks": {
// "Url": "/health/live"
//},
//"OrchardCore_Email": {
// "DefaultSender": "",
// "DeliveryMethod": "Network",
// "PickupDirectoryLocation": "",
// "Host": "localhost",
// "Port": 25,
// // Uncomment if SMTP server runs through a proxy server
// //"ProxyHost": "proxy.domain.com",
// //"ProxyPort": 5050,
// "EncryptionMethod": "SSLTLS",
// "AutoSelectEncryption": false,
// "UseDefaultCredentials": false,
// "RequireCredentials": true,
// "Username": "",
// "Password": ""
//},
//"OrchardCore_ReverseProxy": {
// "ForwardedHeaders": "None"
//},
Expand Down
37 changes: 37 additions & 0 deletions src/OrchardCore.Modules/OrchardCore.Email.Azure/AdminMenu.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using System;
using System.Threading.Tasks;
using Microsoft.Extensions.Localization;
using OrchardCore.Navigation;

namespace OrchardCore.Email.Azure;

public class AdminMenu : INavigationProvider
{
protected readonly IStringLocalizer S;

public AdminMenu(IStringLocalizer<AdminMenu> localizer)
{
S = localizer;
}

public Task BuildNavigationAsync(string name, NavigationBuilder builder)
hishamco marked this conversation as resolved.
Show resolved Hide resolved
{
if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase))
{
return Task.CompletedTask;
}

builder
.Add(S["Configuration"], configuration => configuration
.Add(S["Settings"], settings => settings
.Add(S["Email"], S["Email"].PrefixPosition(), email => email
.AddClass("email").Id("email")
.Add(S["Azure Email Settings"], S["Azure Email Settings"].PrefixPosition(), options => options
.Action("Options", "Admin", new { area = "OrchardCore.Email.Azure" })
.Permission(Permissions.ViewAzureEmailOptions)
.LocalNav())
)));

return Task.CompletedTask;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace OrchardCore.Email.Azure;

public static class AzureEmailConstants
{
public static readonly string EmailDeliveryServiceName = "azure";
hishamco marked this conversation as resolved.
Show resolved Hide resolved
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace OrchardCore.Email.Azure;

/// <summary>
/// Represents a settings for Azure email.
/// </summary>
public class AzureEmailSettings : EmailSettings
{
/// <summary>
/// Gets or sets the connection string.
/// </summary>
public string ConnectionString { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using OrchardCore.Email.Azure.ViewModels;

namespace OrchardCore.Email.Azure.Controllers;

public class AdminController : Controller
{
private readonly IAuthorizationService _authorizationService;
private readonly AzureEmailSettings _options;

public AdminController(IAuthorizationService authorizationService, IOptions<AzureEmailSettings> options)
{
_authorizationService = authorizationService;
_options = options.Value;
}

public async Task<IActionResult> Options()
{
if (!await _authorizationService.AuthorizeAsync(User, Permissions.ViewAzureEmailOptions))
{
return Forbid();
}

var model = new OptionsViewModel
{
DefaultSender = _options.DefaultSender,
ConnectionString = _options.ConnectionString
};

return View(model);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using Microsoft.Extensions.Configuration;
using OrchardCore.Email.Azure;
using OrchardCore.Environment.Shell.Configuration;

namespace Microsoft.Extensions.DependencyInjection;

public static class OrchardCoreBuilderExtensions
{
public static OrchardCoreBuilder ConfigureAzureEmailSettings(this OrchardCoreBuilder builder)
{
builder.ConfigureServices((tenantServices, serviceProvider) =>
{
var configurationSection = serviceProvider.GetRequiredService<IShellConfiguration>().GetSection("OrchardCore_Email_Azure");

tenantServices.PostConfigure<AzureEmailSettings>(settings => configurationSection.Bind(settings));
});

return builder;
}
}
11 changes: 11 additions & 0 deletions src/OrchardCore.Modules/OrchardCore.Email.Azure/Manifest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using OrchardCore.Modules.Manifest;

[assembly: Module(
Name = "Azure Email",
Author = ManifestConstants.OrchardCoreTeam,
Website = ManifestConstants.OrchardCoreWebsite,
Version = ManifestConstants.OrchardCoreVersion,
Description = "Provides email settings configuration and a default email service based on Azure Communication Services (ACS).",
hishamco marked this conversation as resolved.
Show resolved Hide resolved
Dependencies = ["OrchardCore.Email"],
Category = "Messaging"
)]
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
<!-- NuGet properties-->
<Title>OrchardCore Azure Email</Title>
<Description>$(OCFrameworkDescription)

Provides email settings configuration and a default email service based on Azure Communication Services.</Description>
hishamco marked this conversation as resolved.
Show resolved Hide resolved
<PackageTags>$(PackageTags) OrchardCoreFramework</PackageTags>
</PropertyGroup>

<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\OrchardCore\OrchardCore.Admin.Abstractions\OrchardCore.Admin.Abstractions.csproj" />
<ProjectReference Include="..\..\OrchardCore\OrchardCore.DisplayManagement\OrchardCore.DisplayManagement.csproj" />
<ProjectReference Include="..\..\OrchardCore\OrchardCore.Email.Core\OrchardCore.Email.Core.csproj" />
<ProjectReference Include="..\..\OrchardCore\OrchardCore.Navigation.Core\OrchardCore.Navigation.Core.csproj" />
<ProjectReference Include="..\..\OrchardCore\OrchardCore.Module.Targets\OrchardCore.Module.Targets.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Azure.Communication.Email" />
</ItemGroup>

</Project>
32 changes: 32 additions & 0 deletions src/OrchardCore.Modules/OrchardCore.Email.Azure/Permissions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using OrchardCore.Security.Permissions;

namespace OrchardCore.Email.Azure;

public class Permissions : IPermissionProvider
{
public static readonly Permission ViewAzureEmailOptions = new(nameof(ViewAzureEmailOptions), "View Azure Email Options");
hishamco marked this conversation as resolved.
Show resolved Hide resolved

public Task<IEnumerable<Permission>> GetPermissionsAsync()
{
return Task.FromResult(new[]
{
ViewAzureEmailOptions,
}
.AsEnumerable());
}

public IEnumerable<PermissionStereotype> GetDefaultStereotypes()
{
return new[]
{
new PermissionStereotype
{
Name = "Administrator",
Permissions = new[] { ViewAzureEmailOptions },
},
};
}
}