Hangfire wasn't too happy with System.Net.MailAddress

This commit is contained in:
Sebastiaan Janssen
2016-11-07 15:35:00 +01:00
parent 2128fb883a
commit 367a98be56
2 changed files with 6 additions and 6 deletions
@@ -27,7 +27,7 @@ namespace OurUmbraco.NotificationsCore.Notifications
using (var smtpClient = new SmtpClient())
{
var fromMailAddress = notificationMail.FromMailAddress;
var fromMailAddress = new MailAddress(notificationMail.FromMail, notificationMail.FromName);
var subject = string.Format("{0} - '{1}'", notificationMail.Subject, topic.Title);
var domain = notificationMail.Domain;
@@ -8,7 +8,8 @@ namespace OurUmbraco.NotificationsCore.Notifications
{
public class NotificationMail
{
public MailAddress FromMailAddress;
public string FromName;
public string FromMail;
public string Subject;
public string Domain;
public string Body;
@@ -30,12 +31,11 @@ namespace OurUmbraco.NotificationsCore.Notifications
cont.AppendChild(details.ImportNode(node, true));
var detailsChild = details.AppendChild(cont);
var fromMail = detailsChild.SelectSingleNode("//from/email").InnerText;
var fromName = detailsChild.SelectSingleNode("//from/name").InnerText;
var notificationMail = new NotificationMail
{
FromMailAddress = new MailAddress(fromMail, fromName),
FromMail = detailsChild.SelectSingleNode("//from/email").InnerText,
FromName = detailsChild.SelectSingleNode("//from/name").InnerText,
Subject = detailsChild.SelectSingleNode("//subject").InnerText,
Domain = detailsChild.SelectSingleNode("//domain").InnerText,
Body = detailsChild.SelectSingleNode("//body").InnerText