mirror of
https://github.com/oqtane/oqtane.framework.git
synced 2025-05-17 10:09:24 +00:00
commit
fa1a5ab913
@ -96,7 +96,6 @@ namespace Oqtane.Infrastructure
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
MailMessage mailMessage = new MailMessage();
|
MailMessage mailMessage = new MailMessage();
|
||||||
bool includeheader = true;
|
|
||||||
|
|
||||||
// sender
|
// sender
|
||||||
if (settings.ContainsKey("SMTPRelay") && settings["SMTPRelay"] == "True" && !string.IsNullOrEmpty(notification.FromEmail))
|
if (settings.ContainsKey("SMTPRelay") && settings["SMTPRelay"] == "True" && !string.IsNullOrEmpty(notification.FromEmail))
|
||||||
@ -109,7 +108,6 @@ namespace Oqtane.Infrastructure
|
|||||||
{
|
{
|
||||||
mailMessage.From = new MailAddress(notification.FromEmail);
|
mailMessage.From = new MailAddress(notification.FromEmail);
|
||||||
}
|
}
|
||||||
includeheader = false;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -130,27 +128,29 @@ namespace Oqtane.Infrastructure
|
|||||||
mailMessage.Subject = notification.Subject;
|
mailMessage.Subject = notification.Subject;
|
||||||
|
|
||||||
//body
|
//body
|
||||||
if (includeheader)
|
mailMessage.Body = "";
|
||||||
|
|
||||||
|
// check if email is being sent from SMTP Sender rather than notification sender
|
||||||
|
if (!string.IsNullOrEmpty(notification.FromEmail) && mailMessage.From.Address != notification.FromEmail)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(notification.FromEmail) && !string.IsNullOrEmpty(notification.FromDisplayName))
|
// include information of who sent the notification in the body
|
||||||
|
mailMessage.Body += "From: ";
|
||||||
|
if (!string.IsNullOrEmpty(notification.FromDisplayName))
|
||||||
{
|
{
|
||||||
mailMessage.Body = "From: " + notification.FromDisplayName + "<" + notification.FromEmail + ">" + "\n";
|
mailMessage.Body += notification.FromDisplayName + " <" + notification.FromEmail + ">\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mailMessage.Body = "From: " + site.Name + "\n";
|
mailMessage.Body += notification.FromEmail + "\n";
|
||||||
}
|
|
||||||
mailMessage.Body += "Sent: " + notification.CreatedOn + "\n";
|
|
||||||
if (!string.IsNullOrEmpty(notification.ToDisplayName))
|
|
||||||
{
|
|
||||||
mailMessage.Body += "To: " + notification.ToDisplayName + "<" + notification.ToEmail + ">" + "\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mailMessage.Body += "To: " + notification.ToEmail + "\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
mailMessage.Body += notification.Body;
|
// check if notification was created in the past
|
||||||
|
if (notification.CreatedOn.Date != DateTime.UtcNow.Date)
|
||||||
|
{
|
||||||
|
mailMessage.Body += "Sent: " + notification.CreatedOn + "\n";
|
||||||
|
}
|
||||||
|
mailMessage.Body += "\n" + notification.Body;
|
||||||
|
|
||||||
// encoding
|
// encoding
|
||||||
mailMessage.SubjectEncoding = System.Text.Encoding.UTF8;
|
mailMessage.SubjectEncoding = System.Text.Encoding.UTF8;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user