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

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> <configuration>
<appSettings> <appSettings>
<add key="SmtpClientHost" value="smtp.yandex.ru" /> <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="PopHost" value="pop.yandex.com" />
<add key="PopPort" value="995" /> <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" /> <add key="MailPassword" value="pyzzqswchjevecec" />
</appSettings> </appSettings>
</configuration> </configuration>

View File

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

View File

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