Skip to content

Commit

Permalink
Email message option for read notification. (#7669)
Browse files Browse the repository at this point in the history
Fixes #7668
  • Loading branch information
LorenzoFrediani-Laser authored and sebastienros committed Apr 20, 2017
1 parent a200e35 commit 7c725bf
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,16 @@ public override IEnumerable<LocalizedString> Execute(WorkflowContext workflowCon
var replyTo = activityContext.GetState<string>("ReplyTo");
var bcc = activityContext.GetState<string>("Bcc");
var cc = activityContext.GetState<string>("CC");
var notifyReadEmail = activityContext.GetState<bool>("NotifyReadEmail");

var parameters = new Dictionary<string, object> {
{"Subject", subject},
{"Body", body},
{"Recipients", recipients},
{"ReplyTo", replyTo},
{"Bcc", bcc},
{"CC", cc}
{"CC", cc},
{"NotifyReadEmail",notifyReadEmail }
};

var queued = activityContext.GetState<bool>("Queued");
Expand Down
7 changes: 6 additions & 1 deletion src/Orchard.Web/Modules/Orchard.Email/Forms/EmailForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,12 @@ public void Describe(DescribeContext context) {
Id: "Body", Name: "Body",
Title: T("Body"),
Description: T("The body of the email message."),
Classes: new[] {"tokenized"})
Classes: new[] {"tokenized"}),
_NotifyReadEmail: New.Checkbox(
Id: "NotifyReadEmail", Name: "NotifyReadEmail",
Title: T("Notify email read"),
Checked: false, Value: "true",
Description: T("Notify when email sent gets read by the recipient."))
));

if (jobsQueueEnabled) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,13 @@ public void Process(IDictionary<string, object> parameters) {
mailMessage.ReplyToList.Add(new MailAddress(recipient));
}
}

if (parameters.ContainsKey("NotifyReadEmail")) {
if (parameters["NotifyReadEmail"] is bool) {
if ((bool)(parameters["NotifyReadEmail"])) {
mailMessage.Headers.Add("Disposition-Notification-To", mailMessage.From.ToString());
}
}
}
_smtpClientField.Value.Send(mailMessage);
}
catch (Exception e) {
Expand Down

0 comments on commit 7c725bf

Please sign in to comment.