Permalink
Browse files

Handle errors somewhat

  • Loading branch information...
1 parent 0e31098 commit 44127bf1d04b21186f85553b90c4b9c79adb7768 @aredridel committed Oct 4, 2010
Showing with 4 additions and 4 deletions.
  1. +4 −4 bin/smtpd
View
@@ -23,14 +23,14 @@ var server = smtp.createServer(function(conn) {
conn.on('EHLO', f)
conn.on('DATA', function(message) {
console.log("Message incoming! From " + message.sender.address + " to " + message.recipients.map(function(e) { return e.address }).join(', '))
- message.pause()
destination.appendMessage(function(error, mbox) {
if(error) {
- console.log("Error: " + error)
- message.emit('error', new Error("451 Internal Error"))
+ console.log("Message Error: " + error)
+ message.emit('error', {smtpCode: "451",
+smtpMessage: "Internal Error"})
message.resume()
} else {
- sys.pump(message, mbox, function() {
+ sys.pump(message, mbox, function(error) {
mbox.end()
message.accept()
})

0 comments on commit 44127bf

Please sign in to comment.