aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarcinzelent <zelent.marcin@gmail.com>2017-12-04 10:14:32 +0100
committermarcinzelent <zelent.marcin@gmail.com>2017-12-04 10:14:32 +0100
commita3ad4472de9096ec0a12d15097048578b3514d4b (patch)
tree6779f35ddd2672a2b82e7817b15d29a3903e5801 /PollutometerWebApi/EmailSender.cs
parent644d63b7073f59290029bf084fb57db5a501309d (diff)
Improved calculating of AQI and sending e-mail.
Diffstat (limited to 'PollutometerWebApi/EmailSender.cs')
-rw-r--r--PollutometerWebApi/EmailSender.cs19
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