mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Re-applying FromAddress/FromName changes from 1c93e4a501
This commit is contained in:
@@ -52,7 +52,8 @@ namespace Orchard.Email.Services {
|
|||||||
Subject = Read(parameters, "Subject"),
|
Subject = Read(parameters, "Subject"),
|
||||||
Recipients = Read(parameters, "Recipients"),
|
Recipients = Read(parameters, "Recipients"),
|
||||||
ReplyTo = Read(parameters, "ReplyTo"),
|
ReplyTo = Read(parameters, "ReplyTo"),
|
||||||
From = Read(parameters, "From"),
|
FromAddress = Read(parameters, "FromAddress"),
|
||||||
|
FromName = Read(parameters, "FromName"),
|
||||||
Bcc = Read(parameters, "Bcc"),
|
Bcc = Read(parameters, "Bcc"),
|
||||||
Cc = Read(parameters, "CC")
|
Cc = Read(parameters, "CC")
|
||||||
};
|
};
|
||||||
@@ -100,16 +101,18 @@ namespace Orchard.Email.Services {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var fromAddress = default(MailboxAddress);
|
var fromAddress = default(MailboxAddress);
|
||||||
if (!String.IsNullOrWhiteSpace(emailMessage.From)) {
|
if (!String.IsNullOrWhiteSpace(emailMessage.FromAddress)) {
|
||||||
fromAddress = MailboxAddress.Parse(emailMessage.From);
|
fromAddress = MailboxAddress.Parse(emailMessage.FromAddress);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Take 'From' address from site settings or web.config.
|
// Take 'From' address from site settings or web.config.
|
||||||
fromAddress = !String.IsNullOrWhiteSpace(_smtpSettings.Address)
|
fromAddress = !String.IsNullOrWhiteSpace(_smtpSettings.FromAddress)
|
||||||
? MailboxAddress.Parse(_smtpSettings.Address)
|
? MailboxAddress.Parse(_smtpSettings.FromAddress)
|
||||||
: MailboxAddress.Parse(((SmtpSection)ConfigurationManager.GetSection("system.net/mailSettings/smtp")).From);
|
: MailboxAddress.Parse(((SmtpSection)ConfigurationManager.GetSection("system.net/mailSettings/smtp")).From);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fromAddress.Name = string.IsNullOrWhiteSpace(emailMessage.FromName) ? _smtpSettings.FromName : emailMessage.FromName;
|
||||||
|
|
||||||
mailMessage.From.Add(fromAddress);
|
mailMessage.From.Add(fromAddress);
|
||||||
|
|
||||||
if (!String.IsNullOrWhiteSpace(emailMessage.ReplyTo)) {
|
if (!String.IsNullOrWhiteSpace(emailMessage.ReplyTo)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user