Merge pull request #14 from derwassi/master

display of multipart messages
This commit is contained in:
Ian Kent 2014-12-12 14:47:01 +00:00
commit 36a5728c5d
2 changed files with 10 additions and 3 deletions

View file

@ -181,7 +181,7 @@ mailhogApp.controller('MailCtrl', function ($scope, $http, $sce, $timeout) {
$scope.getMessagePlain = function(message) {
var l = $scope.findMatchingMIME(message, "text/plain");
if(l != null && l !== "undefined") {
return l.Body;
return $scope.tryDecode(l);
}
return message.Content.Body;
}
@ -217,11 +217,18 @@ mailhogApp.controller('MailCtrl', function ($scope, $http, $sce, $timeout) {
$scope.getMessageHTML = function(message) {
var l = $scope.findMatchingMIME(message, "text/html");
if(l != null && l !== "undefined") {
return l.Body;
return $scope.tryDecode(l);
}
return "<HTML not found>";
}
$scope.tryDecode = function(l){
if(l.Headers && l.Headers["Content-Type"] && l.Headers["Content-Transfer-Encoding"]){
return $scope.tryDecodeContent({Content:l},l.Body.replace(/=[\r\n]+/gm,""));
}else{
return l.Body;
}
};
$scope.date = function(timestamp) {
return (new Date(timestamp)).toString();
};

View file

@ -228,7 +228,7 @@
</ul>
<div class="tab-content">
<div ng-if="hasHTML(preview)" ng-class="{ active: hasHTML(preview) }" class="tab-pane" id="preview-html" ng-bind-html="preview.previewHTML"></div>
<div class="tab-pane" ng-class="{ active: !hasHTML(preview) }" id="preview-plain">{{ tryDecodeContent(preview, getMessagePlain(preview)) }}</div>
<div class="tab-pane" ng-class="{ active: !hasHTML(preview) }" id="preview-plain">{{ getMessagePlain(preview) }}</div>
<div class="tab-pane" id="preview-source">{{ getSource(preview) }}</div>
<div class="tab-pane" id="preview-mime">
<div ng-repeat="part in preview.MIME.Parts" class="mime-part">