#20606: Fixed implementation of e-mail reply-to functionality.

There was a breaking change introduced in the initial commit. ReplyTo field is optional but was not treated as such.
Also, made it possible to specify more than one reply-to address, similar to recipients.
This commit is contained in:
Piotr Szmyd
2015-01-28 19:45:35 +01:00
parent 085a7b7445
commit 7d462819bc

View File

@@ -48,7 +48,7 @@ namespace Orchard.Email.Services {
Body = parameters["Body"] as string,
Subject = parameters["Subject"] as string,
Recipients = parameters["Recipients"] as string,
ReplyTo = parameters["ReplyTo"] as string
ReplyTo = parameters.ContainsKey("ReplyTo") ? parameters["ReplyTo"] as string : null
};
if (emailMessage.Recipients.Length == 0) {
@@ -78,7 +78,9 @@ namespace Orchard.Email.Services {
}
if (!String.IsNullOrWhiteSpace(emailMessage.ReplyTo)) {
mailMessage.ReplyToList.Add(new MailAddress(emailMessage.ReplyTo));
foreach (var recipient in emailMessage.ReplyTo.Split(new [] {',', ';'}, StringSplitOptions.RemoveEmptyEntries)) {
mailMessage.ReplyToList.Add(new MailAddress(recipient));
}
}
_smtpClientField.Value.Send(mailMessage);