mirror of
https://gitlab.com/ric_harvey/MailHog.git
synced 2024-11-23 22:34:04 +00:00
Merge branch 'master' of github.com:ian-kent/Go-MailHog
This commit is contained in:
commit
ba6490cc86
3 changed files with 18 additions and 11 deletions
16
APIv1.md
16
APIv1.md
|
@ -3,39 +3,39 @@ Go-MailHog API v1
|
|||
|
||||
The v1 API is a RESTful HTTP JSON API.
|
||||
|
||||
### GET /v1/api/events
|
||||
### GET /api/v1/events
|
||||
|
||||
Streams new messages using EventSource and chunked encoding
|
||||
|
||||
### GET /v1/api/messages
|
||||
### GET /api/v1/messages
|
||||
|
||||
Lists all messages excluding message content
|
||||
|
||||
### DELETE /v1/api/messages
|
||||
### DELETE /api/v1/messages
|
||||
|
||||
Deletes all messages
|
||||
|
||||
Returns a ```200``` response code if message deletion was successful.
|
||||
|
||||
### GET /v1/api/messages/{ message_id }
|
||||
### GET /api/v1/messages/{ message_id }
|
||||
|
||||
Returns an individual message including message content
|
||||
|
||||
### DELETE /v1/api/messages/{ message_id }
|
||||
### DELETE /api/v1/messages/{ message_id }
|
||||
|
||||
Delete an individual message
|
||||
|
||||
Returns a ```200``` response code if message deletion was successful.
|
||||
|
||||
### GET /v1/api/messages/{ message_id }/download
|
||||
### GET /api/v1/messages/{ message_id }/download
|
||||
|
||||
Download the complete message
|
||||
|
||||
### GET /v1/api/messages/{ message_id }/mime/part/{ part_index }/download
|
||||
### GET /api/v1/messages/{ message_id }/mime/part/{ part_index }/download
|
||||
|
||||
Download a MIME part
|
||||
|
||||
### POST /v1/api/messages/{ message_id }/release
|
||||
### POST /api/v1/messages/{ message_id }/release
|
||||
|
||||
Release the message to an SMTP server
|
||||
|
||||
|
|
|
@ -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();
|
||||
};
|
||||
|
|
|
@ -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">
|
||||
|
|
Loading…
Reference in a new issue