diff options
Diffstat (limited to 'PollutometerWebApi/EmailSender.cs')
-rw-r--r-- | PollutometerWebApi/EmailSender.cs | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/PollutometerWebApi/EmailSender.cs b/PollutometerWebApi/EmailSender.cs index 6d8702e..287551e 100644 --- a/PollutometerWebApi/EmailSender.cs +++ b/PollutometerWebApi/EmailSender.cs @@ -1,17 +1,13 @@ using System; -using System.Collections.Generic; using System.Net.Mail; +using PollutometerWebApi.Models; namespace PollutometerWebApi { - public class EmailSender + public static class EmailSender { - public EmailSender() {} - - public static void SendEmail(string gasName, double max) + public static void SendEmail(Aqi aqi) { - try - { MailMessage mail = new MailMessage("***REMOVED***", "***REMOVED***@edu.easj.dk"); SmtpClient client = new SmtpClient() { @@ -29,14 +25,9 @@ namespace PollutometerWebApi "\n" + "<img src=\"https://i.imgflip.com/20b4q2.jpg\"/>\n" + "\n" + - $"<p>The warning was triggered by {gasName}.</p>\n" + - $"<p>Air quality index: {max}</p>"; + $"<p>The warning was triggered by {aqi.GasName}.</p>\n" + + $"<p>Air quality index: {aqi.Value}</p>"; client.Send(mail); - } - catch(Exception ex) - { - Console.Write(ex.Message); - } } } }
\ No newline at end of file |