- Addition of an existing png (OrchardLogo.png) as attachment within "Test Smtp Settings" Section, in order to demonstrate functionality of support for attachments in email

This commit is contained in:
HermesSbicego-Laser 2016-10-28 15:22:48 +02:00
parent e50bd607b7
commit e3a7059edf
2 changed files with 9 additions and 3 deletions
src/Orchard.Web/Modules/Orchard.Email
Controllers
Views/EditorTemplates/Parts

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Web.Hosting;
using System.Web.Mvc;
using Orchard.ContentManagement;
using Orchard.Email.Models;
@ -56,7 +57,8 @@ namespace Orchard.Email.Controllers {
{"Body", testSettings.Body},
{"ReplyTo", testSettings.ReplyTo},
{"Bcc", testSettings.Bcc},
{"CC", testSettings.Cc}
{"CC", testSettings.Cc},
{ "Attachments", new List<string>() { HostingEnvironment.MapPath("~/Media/OrchardLogo.png") } }
});
}
@ -64,10 +66,10 @@ namespace Orchard.Email.Controllers {
return Json(new { error = fakeLogger.Message });
}
return Json(new {status = T("Message sent.").Text});
return Json(new { status = T("Message sent.").Text });
}
catch (Exception e) {
return Json(new {error = e.Message});
return Json(new { error = e.Message });
}
finally {
var smtpChannelComponent = _smtpChannel as Component;

View File

@ -91,6 +91,10 @@
<div>
<textarea id="emailtestbody"></textarea>
</div>
<div>
<label>@T("Attachments:")</label>
<img src="~/Media/OrchardLogo.png" style="width:100px" alt="@T("Orchard icon")" title="@T("The Orchard icon will be attached to this test e-mail")"/>
</div>
<div>
<button type="button" id="emailtestsend" class="button grey">@T("Send")</button>
</div>