Skip to content

Instantly share code, notes, and snippets.

@baudehlo
Created October 6, 2011 20:43
Show Gist options
  • Save baudehlo/1268608 to your computer and use it in GitHub Desktop.
Save baudehlo/1268608 to your computer and use it in GitHub Desktop.
diff --git a/plugins/queue/smtp_proxy.js b/plugins/queue/smtp_proxy.js
index d79b8e8..cb7217e 100644
--- a/plugins/queue/smtp_proxy.js
+++ b/plugins/queue/smtp_proxy.js
@@ -140,6 +140,7 @@ exports.hook_mail = function (next, connection, params) {
var mail_from = params[0];
var data_marker = 0;
var smtp_proxy = _get_smtp_proxy(self, next, connection);
+ var dot_sent = false;
smtp_proxy.send_data = function () {
if (data_marker < connection.transaction.data_lines.length) {
@@ -151,6 +152,7 @@ exports.hook_mail = function (next, connection, params) {
}
else {
smtp_proxy.socket.send_command('dot');
+ dot_sent = true;
}
}
@@ -285,7 +287,7 @@ exports.hook_mail = function (next, connection, params) {
smtp_proxy.socket.on('drain', function() {
self.logprotocol("Drained");
- if (smtp_proxy.command === 'dot') {
+ if (!dot_sent && smtp_proxy.command === 'mailbody') {
smtp_proxy.send_data();
}
});
@@ -320,7 +322,7 @@ exports.hook_data = function (next, connection) {
exports.hook_queue = function (next, connection) {
if (!connection.notes.smtp_proxy) return next();
var smtp_proxy = connection.notes.smtp_proxy;
- smtp_proxy.command = 'dot';
+ smtp_proxy.command = 'mailbody';
smtp_proxy.next = next;
smtp_proxy.send_data();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment