feat(backend): add add email address endpoint

This commit is contained in:
sam 2024-10-02 00:52:49 +02:00
parent 7f971e8549
commit 5b17c716cb
Signed by: sam
GPG key ID: B4EF20DDE721CAA1
6 changed files with 114 additions and 3 deletions

View file

@ -33,4 +33,31 @@ public class MailService(ILogger logger, IMailer mailer, IQueue queue, Config co
}
});
}
public void QueueAddEmailAddressEmail(string to, string code, string username)
{
_logger.Debug("Sending add email address email to {ToEmail}", to);
queue.QueueAsyncTask(async () =>
{
try
{
await mailer.SendAsync(
new AddEmailMailable(
config,
new AddEmailMailableView
{
BaseUrl = config.BaseUrl,
To = to,
Code = code,
Username = username,
}
)
);
}
catch (Exception exc)
{
_logger.Error(exc, "Sending add email address email");
}
});
}
}