diff options
Diffstat (limited to 'PollutometerWebApi/EmailSender.cs')
-rw-r--r-- | PollutometerWebApi/EmailSender.cs | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/PollutometerWebApi/EmailSender.cs b/PollutometerWebApi/EmailSender.cs index f62a9ca..6cc60fc 100644 --- a/PollutometerWebApi/EmailSender.cs +++ b/PollutometerWebApi/EmailSender.cs @@ -8,26 +8,27 @@ namespace PollutometerWebApi { public static void SendEmail(Aqi aqi) { - MailMessage mail = new MailMessage("***REMOVED***", "alek2026@edu.easj.dk"); - SmtpClient client = new SmtpClient() - { - Host = "mail.cock.li", - Port = 587, - EnableSsl = true, - Timeout = 100, - DeliveryMethod = SmtpDeliveryMethod.Network, - UseDefaultCredentials = false, - Credentials = new System.Net.NetworkCredential("***REMOVED***", "***REMOVED***") - }; - mail.Subject = $"Pollutometer warning - {DateTime.Now}"; - mail.IsBodyHtml = true; - mail.Body = "<h3>WARNING!</h3>\n" + - "\n" + - "<img src=\"https://i.imgflip.com/20b4q2.jpg\"/>\n" + - "\n" + + MailMessage mail = new MailMessage("***REMOVED***", "alek2026@edu.easj.dk"); + SmtpClient client = new SmtpClient() + { + Host = "mail.cock.li", + Port = 587, + EnableSsl = true, + Timeout = 100, + DeliveryMethod = SmtpDeliveryMethod.Network, + UseDefaultCredentials = false, + Credentials = new System.Net.NetworkCredential("***REMOVED***", "***REMOVED***") + }; + mail.Subject = $"Pollutometer warning - {DateTime.Now}"; + mail.IsBodyHtml = true; + mail.Body = "<h3>WARNING!</h3>\n" + + "\n" + + "<img src=\"https://i.imgflip.com/20b4q2.jpg\"/>\n" + + "\n" + $"<p>The warning was triggered by {aqi.GasName}.</p>\n" + - $"<p>Air quality index: {aqi.Value}</p>"; - client.Send(mail); + $"<p>Air quality index: {aqi.Value}</p>" + + $"<p>The AQI level is {aqi.Level}!"; + client.Send(mail); } } }
\ No newline at end of file |