complete lab 7
This commit is contained in:
parent
2c4cb0dbb2
commit
655b808c3c
@ -30,8 +30,15 @@ public class MailKitWorker : AbstractMailWorker
|
|||||||
objSmtpClient.EnableSsl = true;
|
objSmtpClient.EnableSsl = true;
|
||||||
objSmtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
|
objSmtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
|
||||||
objSmtpClient.Credentials = new NetworkCredential(_mailLogin, _mailPassword);
|
objSmtpClient.Credentials = new NetworkCredential(_mailLogin, _mailPassword);
|
||||||
|
try
|
||||||
|
{
|
||||||
await Task.Run(() => objSmtpClient.Send(objMailMessage));
|
await Task.Run(() => objSmtpClient.Send(objMailMessage));
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
protected override async Task<List<MessageInfoBindingModel>> ReceiveMailAsync()
|
protected override async Task<List<MessageInfoBindingModel>> ReceiveMailAsync()
|
||||||
{
|
{
|
||||||
var list = new List<MessageInfoBindingModel>();
|
var list = new List<MessageInfoBindingModel>();
|
||||||
|
@ -23,7 +23,7 @@ builder.Services.AddTransient<IClientLogic, ClientLogic>();
|
|||||||
builder.Services.AddTransient<ISushiLogic, SushiLogic>();
|
builder.Services.AddTransient<ISushiLogic, SushiLogic>();
|
||||||
builder.Services.AddTransient<IImplementerLogic, ImplementerLogic>();
|
builder.Services.AddTransient<IImplementerLogic, ImplementerLogic>();
|
||||||
builder.Services.AddTransient<IMessageInfoLogic, MessageInfoLogic>();
|
builder.Services.AddTransient<IMessageInfoLogic, MessageInfoLogic>();
|
||||||
builder.Services.AddTransient<AbstractMailWorker, MailKitWorker>();
|
builder.Services.AddSingleton<AbstractMailWorker, MailKitWorker>();
|
||||||
|
|
||||||
builder.Services.AddControllers();
|
builder.Services.AddControllers();
|
||||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||||
|
@ -10,6 +10,6 @@
|
|||||||
"SmtpClientPort": "587",
|
"SmtpClientPort": "587",
|
||||||
"PopHost": "pop.gmail.com",
|
"PopHost": "pop.gmail.com",
|
||||||
"PopPort": "995",
|
"PopPort": "995",
|
||||||
"MailLogin": "labwork15kafis@gmail.com",
|
"MailLogin": "sushibarulyanosk7@gmail.com",
|
||||||
"MailPassword": "passlab15"
|
"MailPassword": "qwzj uqlx uukp bpmc"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user