-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
增加邮件发送功能
- Loading branch information
Showing
13 changed files
with
180 additions
and
2 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,11 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netcoreapp2.0</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Abp.MailKit" Version="3.2.4" /> | ||
</ItemGroup> | ||
|
||
</Project> |
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,51 @@ | ||
using Abp.Configuration; | ||
using Abp.Localization; | ||
using Abp.Net.Mail; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace Birthday.Mail | ||
{ | ||
public class BirthdayEmailSettingProvider : SettingProvider | ||
{ | ||
public override IEnumerable<SettingDefinition> GetSettingDefinitions(SettingDefinitionProviderContext context) | ||
{ | ||
return new[] | ||
{ | ||
new SettingDefinition(EmailSettingNames.Smtp.Host, "smtp.qq.com", L("SmtpHost"), | ||
scopes: SettingScopes.Application | SettingScopes.Tenant), | ||
|
||
new SettingDefinition(EmailSettingNames.Smtp.Port, "465", L("SmtpPort"), | ||
scopes: SettingScopes.Application | SettingScopes.Tenant), | ||
|
||
new SettingDefinition(EmailSettingNames.Smtp.UserName, "[email protected]", L("Username"), | ||
scopes: SettingScopes.Application | SettingScopes.Tenant), | ||
|
||
new SettingDefinition(EmailSettingNames.Smtp.Password, "daulgejvjyzbcabf", L("Password"), | ||
scopes: SettingScopes.Application | SettingScopes.Tenant), | ||
|
||
new SettingDefinition(EmailSettingNames.Smtp.Domain, "smtp.qq.com", L("DomainName"), | ||
scopes: SettingScopes.Application | SettingScopes.Tenant), | ||
|
||
new SettingDefinition(EmailSettingNames.Smtp.EnableSsl, "true", L("UseSSL"), | ||
scopes: SettingScopes.Application | SettingScopes.Tenant), | ||
|
||
new SettingDefinition(EmailSettingNames.Smtp.UseDefaultCredentials, "true", L("UseDefaultCredentials"), | ||
scopes: SettingScopes.Application | SettingScopes.Tenant), | ||
|
||
new SettingDefinition(EmailSettingNames.DefaultFromAddress, "MyDefaultFromAddress", | ||
L("DefaultFromSenderEmailAddress"), scopes: SettingScopes.Application | SettingScopes.Tenant), | ||
|
||
new SettingDefinition(EmailSettingNames.DefaultFromDisplayName, "MyDefaultFromDisplayName", | ||
L("DefaultFromSenderDisplayName"), scopes: SettingScopes.Application | SettingScopes.Tenant) | ||
}; | ||
} | ||
|
||
private static ILocalizableString L(string name) | ||
{ | ||
return new LocalizableString(name, BirthdayConsts.LocalizationSourceName); | ||
} | ||
|
||
} | ||
} |
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,22 @@ | ||
using Abp.MailKit; | ||
using Abp.Modules; | ||
using Abp.Reflection.Extensions; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace Birthday.Mail | ||
{ | ||
[DependsOn(typeof(AbpMailKitModule))] | ||
public class BirthdayMailModule : AbpModule | ||
{ | ||
public override void PreInitialize() | ||
{ | ||
Configuration.Settings.Providers.Add<BirthdayEmailSettingProvider>(); | ||
} | ||
public override void Initialize() | ||
{ | ||
IocManager.RegisterAssemblyByConvention(typeof(BirthdayMailModule).GetAssembly()); | ||
} | ||
} | ||
} |
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,34 @@ | ||
using Abp.Configuration; | ||
using Abp.Domain.Services; | ||
using Abp.Net.Mail; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace Birthday.Mail | ||
{ | ||
public class MailSendManager : IDomainService | ||
{ | ||
private readonly IEmailSender _emailSender; | ||
|
||
private readonly ISettingManager _settingManager; | ||
|
||
public MailSendManager(IEmailSender emailSender, ISettingManager settingManager) | ||
{ | ||
_emailSender = emailSender; | ||
_settingManager = settingManager; | ||
} | ||
|
||
public void SendMail() | ||
{ | ||
_emailSender.Send( | ||
from: _settingManager.GetSettingValue(EmailSettingNames.DefaultFromAddress), | ||
to: "", | ||
subject: "", | ||
body: "", | ||
isBodyHtml: true | ||
); | ||
} | ||
|
||
} | ||
} |
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,30 @@ | ||
using Abp.Configuration; | ||
using Abp.Domain.Services; | ||
using Abp.Net.Mail; | ||
|
||
namespace Birthday.Mail | ||
{ | ||
public class TaskManger : IDomainService | ||
{ | ||
private readonly IEmailSender _emailSender; | ||
|
||
private readonly ISettingManager _settingManager; | ||
|
||
public TaskManger(IEmailSender emailSender, ISettingManager settingManager) | ||
{ | ||
_emailSender = emailSender; | ||
_settingManager = settingManager; | ||
} | ||
|
||
public void Assgin() | ||
{ | ||
_emailSender.Send( | ||
from: _settingManager.GetSettingValue(EmailSettingNames.DefaultFromAddress), | ||
to: "", | ||
subject: "", | ||
body: "", | ||
isBodyHtml: true | ||
); | ||
} | ||
} | ||
} |
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
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
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
15 changes: 15 additions & 0 deletions
15
3.1.2/src/Birthday.Core/EmailSendConfig/EmailSendConfig.cs
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,15 @@ | ||
using Abp.Domain.Entities; | ||
using Abp.Domain.Entities.Auditing; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace Birthday.EmailSendConfig | ||
{ | ||
public class EmailSendConfig : Entity<Guid>, IHasCreationTime, IHasModificationTime | ||
{ | ||
public DateTime CreationTime { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } | ||
|
||
public DateTime? LastModificationTime { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } | ||
} | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
3.1.2/src/Birthday.Web/wwwroot/view-resources/Views/_Bundles/layout-libs.min.js
Large diffs are not rendered by default.
Oops, something went wrong.