diff --git a/assets/js/controllers.js b/assets/js/controllers.js index 5eaa115..622578f 100644 --- a/assets/js/controllers.js +++ b/assets/js/controllers.js @@ -4,6 +4,8 @@ mailhogApp.controller('MailCtrl', function ($scope, $http, $sce) { $scope.cache = {}; $scope.previewAllHeaders = false; + $scope.eventsPending = []; + $scope.refresh = function() { $http.get('/api/v1/messages').success(function(data) { $scope.messages = data; @@ -93,6 +95,26 @@ mailhogApp.controller('MailCtrl', function ($scope, $http, $sce) { $('#confirm-delete-all').modal('show'); } + $scope.releaseOne = function(message) { + $scope.releasing = message; + $('#release-one').modal('show'); + } + $scope.confirmReleaseMessage = function() { + $('#release-one').modal('hide'); + var message = $scope.releasing; + $scope.releasing = null; + + $http.post('/api/v1/messages/' + message.Id + '/release', { + email: $('#release-message-email').val(), + host: $('#release-message-smtp-host').val(), + port: $('#release-message-smtp-port').val(), + }).success(function() { + alert("Message released") + }).error(function(e) { + alert("Failed to release message: " + e) + }); + } + $scope.getSource = function(message) { var source = ""; $.each(message.Content.Headers, function(k, v) { diff --git a/assets/templates/index.html b/assets/templates/index.html index 21c7845..f892155 100644 --- a/assets/templates/index.html +++ b/assets/templates/index.html @@ -114,6 +114,38 @@ +
To release this message, enter a recipient and SMTP server address:
+ +