изменения чтобы работало

This commit is contained in:
bekodeg 2024-06-16 19:49:43 +04:00
parent 757f22bfb5
commit 06a496aa5f
3 changed files with 21 additions and 13 deletions

View File

@ -2,10 +2,10 @@
<configuration>
<appSettings>
<add key="SmtpClientHost" value="smtp.yandex.ru" />
<add key="SmtpClientPort" value="465" />
<add key="SmtpClientPort" value="587" />
<add key="PopHost" value="pop.yandex.com" />
<add key="PopPort" value="995" />
<add key="MailLogin" value="tester.b.moio@ya.ru" />
<add key="MailLogin" value="tester.b.moio@yandex.ru" />
<add key="MailPassword" value="pyzzqswchjevecec" />
</appSettings>
</configuration>

View File

@ -156,18 +156,26 @@ namespace SushiBarBusinessLogic.BusinessLogics
}
private bool SendOrderStatusMail(int clientId, string subject, string text)
{
var client = _clientLogic.ReadElement(new() { Id = clientId });
if (client == null)
try
{
var client = _clientLogic.ReadElement(new() { Id = clientId });
if (client == null)
{
return false;
}
_mailWorker.MailSendAsync(new()
{
MailAddress = client.Email,
Subject = subject,
Text = text
});
return true;
}
catch (Exception ex)
{
return false;
}
_mailWorker.MailSendAsync(new()
{
MailAddress = client.Email,
Subject = subject,
Text = text
});
return true;
}
}
}

View File

@ -9,12 +9,12 @@
"MailConfigBindingModel": {
"SmtpClientHost": "smtp.yandex.ru",
"SmtpClientPort": 465,
"SmtpClientPort": 587,
"PopHost": "pop.yandex.com",
"PopPort": 995,
"MailLogin": "tester.b.moio@ya.ru",
"MailLogin": "tester.b.moio@yandex.ru",
"MailPassword": "pyzzqswchjevecec"
}
}