feat(backend): email registration

This commit is contained in:
sam 2024-09-10 02:39:07 +02:00
parent c77ee660ca
commit 13a0cac663
Signed by: sam
GPG key ID: B4EF20DDE721CAA1
15 changed files with 120 additions and 82 deletions

View file

@ -10,15 +10,22 @@ public class MailService(ILogger logger, IMailer mailer, IQueue queue, Config co
public void QueueAccountCreationEmail(string to, string code)
{
_logger.Debug("Sending account creation email to {ToEmail}", to);
queue.QueueAsyncTask(async () =>
{
await mailer.SendAsync(new AccountCreationMailable(config, new AccountCreationMailableView
_logger.Debug("Sending account creation email to {ToEmail}", to);
try
{
To = to,
Code = code
}));
await mailer.SendAsync(new AccountCreationMailable(config, new AccountCreationMailableView
{
BaseUrl = config.BaseUrl,
To = to,
Code = code
}));
}
catch (Exception exc)
{
_logger.Error(exc, "Sending account creation email");
}
});
}
}