WIP
This commit is contained in:
parent
54b057886c
commit
7fc1ae0650
204 changed files with 4345 additions and 134 deletions
|
|
@ -1,41 +0,0 @@
|
|||
using PostmarkDotNet;
|
||||
|
||||
namespace PlanTempus.Core.Email;
|
||||
|
||||
public class PostmarkEmailService : IEmailService
|
||||
{
|
||||
private readonly PostmarkConfiguration _config;
|
||||
private readonly PostmarkClient _client;
|
||||
|
||||
public PostmarkEmailService(PostmarkConfiguration config)
|
||||
{
|
||||
_config = config;
|
||||
_client = new PostmarkClient(config.ServerToken);
|
||||
}
|
||||
|
||||
public async Task<EmailResult> SendVerificationEmailAsync(string toEmail, string userName, string verifyUrl)
|
||||
{
|
||||
var recipient = _config.TestToEmail ?? toEmail;
|
||||
|
||||
var message = new TemplatedPostmarkMessage
|
||||
{
|
||||
From = _config.FromEmail,
|
||||
To = recipient,
|
||||
TemplateAlias = "code-your-own-1",
|
||||
TemplateModel = new Dictionary<string, object>
|
||||
{
|
||||
{ "USER_NAME", userName },
|
||||
{ "VERIFY_URL", verifyUrl }
|
||||
}
|
||||
};
|
||||
|
||||
var response = await _client.SendMessageAsync(message);
|
||||
|
||||
if (response.Status == PostmarkStatus.Success)
|
||||
{
|
||||
return new EmailResult(true, response.MessageID.ToString(), null);
|
||||
}
|
||||
|
||||
return new EmailResult(false, null, response.Message);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue