Last change
on this file since d86edb7 was a26f6a1, checked in by Danilo <danilo.najkov@…>, 2 years ago |
full auth flow
|
-
Property mode
set to
100644
|
File size:
832 bytes
|
Line | |
---|
1 | using SendGrid;
|
---|
2 | using SendGrid.Helpers.Mail;
|
---|
3 |
|
---|
4 | namespace backend.Email;
|
---|
5 | public interface IEmailSender
|
---|
6 | {
|
---|
7 | Task SendEmailAsync(string subject, string body, string toEmail);
|
---|
8 | }
|
---|
9 | public class EmailSender : IEmailSender
|
---|
10 | {
|
---|
11 | public async Task SendEmailAsync(string subject, string message, string toEmail)
|
---|
12 | {
|
---|
13 | var client = new SendGridClient("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");
|
---|
14 | var msg = new SendGridMessage()
|
---|
15 | {
|
---|
16 | From = new EmailAddress("danilo.najkov@students.finki.ukim.mk", "Danilo"),
|
---|
17 | Subject = subject,
|
---|
18 | PlainTextContent = message,
|
---|
19 | HtmlContent = message
|
---|
20 | };
|
---|
21 | msg.AddTo(new EmailAddress(toEmail));
|
---|
22 | msg.SetClickTracking(false, false);
|
---|
23 | var response = await client.SendEmailAsync(msg);
|
---|
24 | }
|
---|
25 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.