Update email and formating.
This commit is contained in:
@@ -8,6 +8,7 @@ using log4net;
|
||||
using LeafWeb.Core.DAL;
|
||||
using LeafWeb.Core.Entities;
|
||||
using LeafWeb.Core.Utility;
|
||||
using LeafWeb.WebCms.Models;
|
||||
|
||||
namespace LeafWeb.WebCms.Services
|
||||
{
|
||||
@@ -17,13 +18,14 @@ namespace LeafWeb.WebCms.Services
|
||||
|
||||
private readonly string _emailFromAddress;
|
||||
|
||||
private const string EmailSuccessSubject = "LeafWeb results";
|
||||
private const string EmailErrorSubject = "LeafWeb processing error";
|
||||
private const string EmailSystemErrorSubject = "LeafWeb system error";
|
||||
private const string EmailCancelledSubject = "LeafWeb cancelled";
|
||||
private const string SuccessSubject = "LeafWeb results";
|
||||
private const string ErrorSubject = "LeafWeb processing error";
|
||||
private const string SystemErrorSubject = "LeafWeb system error";
|
||||
private const string CancelledSubject = "LeafWeb cancelled";
|
||||
private const string ContactSubject = "LeafWeb Contact Message";
|
||||
|
||||
/// <summary>
|
||||
/// Comma separated values
|
||||
/// Semicolon separated values
|
||||
/// </summary>
|
||||
private readonly string _adminEmailAddresses;
|
||||
|
||||
@@ -93,7 +95,7 @@ namespace LeafWeb.WebCms.Services
|
||||
var body = $"Your leaf analysis job, {leafInput.Identifier}, has been cancelled. " +
|
||||
"Contact the administrator with any questions.";
|
||||
|
||||
var message = new MailMessage(_emailFromAddress, leafInput.Email, FormatSubject(EmailCancelledSubject, leafInput), body);
|
||||
var message = new MailMessage(_emailFromAddress, leafInput.Email, FormatSubject(CancelledSubject, leafInput), body);
|
||||
SendMessage(message);
|
||||
}
|
||||
|
||||
@@ -120,14 +122,14 @@ namespace LeafWeb.WebCms.Services
|
||||
+ Environment.NewLine + Environment.NewLine
|
||||
+ downloadUrl;
|
||||
|
||||
var message = new MailMessage(_emailFromAddress, leafInput.Email, FormatSubject(EmailSuccessSubject, leafInput), body);
|
||||
var message = new MailMessage(_emailFromAddress, leafInput.Email, FormatSubject(SuccessSubject, leafInput), body);
|
||||
SendMessage(message);
|
||||
}
|
||||
else
|
||||
{
|
||||
body += "Please see the attached results.";
|
||||
|
||||
var message = new MailMessage(_emailFromAddress, leafInput.Email, EmailSuccessSubject, body);
|
||||
var message = new MailMessage(_emailFromAddress, leafInput.Email, SuccessSubject, body);
|
||||
|
||||
var fileStreams =
|
||||
(from outputFile in
|
||||
@@ -164,7 +166,7 @@ namespace LeafWeb.WebCms.Services
|
||||
|
||||
body += FormatWarningMessage(leafInput);
|
||||
|
||||
var message = new MailMessage(_emailFromAddress, leafInput.Email, FormatSubject(EmailErrorSubject, leafInput), body);
|
||||
var message = new MailMessage(_emailFromAddress, leafInput.Email, FormatSubject(ErrorSubject, leafInput), body);
|
||||
SendMessage(message);
|
||||
}
|
||||
|
||||
@@ -174,7 +176,25 @@ namespace LeafWeb.WebCms.Services
|
||||
+ "System administrators have been notified. You will be notified again when the system error "
|
||||
+ "has been resolved and your data has been processed.";
|
||||
|
||||
var message = new MailMessage(_emailFromAddress, leafInputEmail, EmailSystemErrorSubject, body);
|
||||
var message = new MailMessage(_emailFromAddress, leafInputEmail, SystemErrorSubject, body);
|
||||
SendMessage(message);
|
||||
}
|
||||
|
||||
public void SendContactEmail(ContactForm contact)
|
||||
{
|
||||
var body =
|
||||
$"via LeafWeb, ${contact.Name} sent the following message from the Contact form." +
|
||||
Environment.NewLine + Environment.NewLine +
|
||||
"Message" +
|
||||
Environment.NewLine + Environment.NewLine +
|
||||
"--------" +
|
||||
Environment.NewLine +
|
||||
contact.Message;
|
||||
|
||||
var message = new MailMessage(_emailFromAddress, _adminEmailAddresses, ContactSubject, body)
|
||||
{
|
||||
From = new MailAddress(contact.Email, contact.Name)
|
||||
};
|
||||
SendMessage(message);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user