mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Merge remote-tracking branch 'remotes/Laser.Orchard/feature/6196_SupportForAttachments' into 1.10.x
This commit is contained in:
@@ -108,7 +108,8 @@ namespace Orchard.Email.Services {
|
|||||||
|
|
||||||
if (!String.IsNullOrWhiteSpace(emailMessage.From)) {
|
if (!String.IsNullOrWhiteSpace(emailMessage.From)) {
|
||||||
mailMessage.From = new MailAddress(emailMessage.From);
|
mailMessage.From = new MailAddress(emailMessage.From);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
// Take 'From' address from site settings or web.config.
|
// Take 'From' address from site settings or web.config.
|
||||||
mailMessage.From = !String.IsNullOrWhiteSpace(_smtpSettings.Address)
|
mailMessage.From = !String.IsNullOrWhiteSpace(_smtpSettings.Address)
|
||||||
? new MailAddress(_smtpSettings.Address)
|
? new MailAddress(_smtpSettings.Address)
|
||||||
@@ -124,12 +125,14 @@ namespace Orchard.Email.Services {
|
|||||||
foreach (var attachmentPath in emailMessage.Attachments) {
|
foreach (var attachmentPath in emailMessage.Attachments) {
|
||||||
if (File.Exists(attachmentPath)) {
|
if (File.Exists(attachmentPath)) {
|
||||||
mailMessage.Attachments.Add(new Attachment(attachmentPath));
|
mailMessage.Attachments.Add(new Attachment(attachmentPath));
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
throw new FileNotFoundException(T("One or more attachments not found.").Text);
|
throw new FileNotFoundException(T("One or more attachments not found.").Text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_smtpClientField.Value.Send(mailMessage);
|
_smtpClientField.Value.Send(mailMessage);
|
||||||
} catch (Exception e) {
|
}
|
||||||
|
catch (Exception e) {
|
||||||
Logger.Error(e, "Could not send email");
|
Logger.Error(e, "Could not send email");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user