Comparing version 0.8.1 to 0.9.0
@@ -67,3 +67,3 @@ /* global angular, app */ | ||
fixIframeHeight = function() { | ||
var body = iframe.contentDocument.getElementsByTagName('body')[0] | ||
@@ -119,3 +119,3 @@ , newHeight = body.scrollHeight; | ||
$scope.delete = function(item) { | ||
Email.delete({ id: item.id }, function(email) { | ||
@@ -134,3 +134,3 @@ $rootScope.$emit('Refresh'); | ||
}; | ||
// Relay email | ||
@@ -137,0 +137,0 @@ $scope.relay = function(item) { |
@@ -56,3 +56,3 @@ | ||
var object = clone(mailObject); | ||
object.id = id; | ||
@@ -62,3 +62,4 @@ object.time = new Date(); | ||
object.envelope = envelope; | ||
object.source = path.join(tempDir, id + '.eml'); | ||
store.push(object); | ||
@@ -87,3 +88,3 @@ | ||
connection.saveRawStream = fs.createWriteStream(path.join(tempDir, id + '.eml')); | ||
connection.saveStream.on('attachment', saveAttachment); | ||
@@ -346,3 +347,3 @@ connection.saveStream.on('end', saveEmail.bind(null,id, { | ||
try { | ||
// Forward Mail options | ||
@@ -426,1 +427,14 @@ var options = { | ||
}; | ||
/** | ||
* Download a given email | ||
*/ | ||
mailServer.getEmailEml = function(id, done) { | ||
mailServer.getEmail(id, function(err, email){ | ||
if (err) return done(err); | ||
var filename = email.id + ".eml"; | ||
done(null, 'message/rfc822', filename, fs.createReadStream(path.join(tempDir, id + '.eml'))); | ||
}); | ||
}; |
@@ -98,2 +98,15 @@ | ||
// Serve email.eml | ||
app.get('/email/:id/download', function(req, res){ | ||
mailserver.getEmailEml(req.params.id, function(err, contentType, filename, readStream){ | ||
if (err) return res.status(404).json('File not found'); | ||
res.setHeader('Content-disposition', 'attachment; filename=' + filename); | ||
res.contentType(contentType); | ||
readStream.pipe(res); | ||
}); | ||
}); | ||
// Get email source from .eml file | ||
@@ -148,3 +161,3 @@ app.get('/email/:id/source', function(req, res){ | ||
io.on('connection', function(socket){ | ||
// When a new email arrives, the 'new' event will be emitted | ||
@@ -151,0 +164,0 @@ mailserver.on('new', emitNewMail(socket)); |
{ | ||
"name": "maildev", | ||
"description": "SMTP Server and Web Interface for reading and testing emails during development", | ||
"version": "0.8.1", | ||
"version": "0.9.0", | ||
"keywords": [ | ||
@@ -6,0 +6,0 @@ "email", |
@@ -130,2 +130,4 @@ # MailDev | ||
0.9.0 - Add ability to download `.eml` files | ||
0.8.1 - Fix temp directory bug introduced in 0.8.0 | ||
@@ -132,0 +134,0 @@ |
Sorry, the diff of this file is not supported yet
1943414
21671
168