{"action":"created","issue":{"url":"https://api.github.com/repos/substack/node-smtp-protocol/issues/41","labels_url":"https://api.github.com/repos/substack/node-smtp-protocol/issues/41/labels{/name}","comments_url":"https://api.github.com/repos/substack/node-smtp-protocol/issues/41/comments","events_url":"https://api.github.com/repos/substack/node-smtp-protocol/issues/41/events","html_url":"https://github.com/substack/node-smtp-protocol/issues/41","id":96208777,"number":41,"title":"ehlo after startTLS has parse error","user":{"login":"snsparrish","id":819815,"avatar_url":"https://avatars.githubusercontent.com/u/819815?v=3","gravatar_id":"","url":"https://api.github.com/users/snsparrish","html_url":"https://github.com/snsparrish","followers_url":"https://api.github.com/users/snsparrish/followers","following_url":"https://api.github.com/users/snsparrish/following{/other_user}","gists_url":"https://api.github.com/users/snsparrish/gists{/gist_id}","starred_url":"https://api.github.com/users/snsparrish/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snsparrish/subscriptions","organizations_url":"https://api.github.com/users/snsparrish/orgs","repos_url":"https://api.github.com/users/snsparrish/repos","events_url":"https://api.github.com/users/snsparrish/events{/privacy}","received_events_url":"https://api.github.com/users/snsparrish/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-21T02:06:12Z","updated_at":"2015-11-13T04:27:36Z","closed_at":null,"body":"When sending 'ehlo' after .startTLS() and the 'tls' event has been triggered returns a parse error with what looks like encrypted info.\r\n\r\nThe code to test:\r\n```\r\nvar sys = require('util'),\r\n    smtp = require('smtp-protocol'),\r\n    serverhostname = 'smtpserver.com',\r\n    smtpport = 587;\r\n    \r\nvar stream = smtp.connect(serverhostname, smtpport, function (mail) {\r\n    console.log('connected');\r\n    mail.ehlo(function(err, code, lines){\r\n        console.log('ehlo responded with code '+sys.inspect(code)+' and lines: '+sys.inspect(lines)+' and error '+sys.inspect(err));\r\n    });\r\n    mail.startTLS({rejectUnauthorized:false}, function(){\r\n        console.log('StartTLS was called');\r\n    });\r\n    mail.on(\"tls\", function(){\r\n        console.log('tls event has been triggered');\r\n        mail.ehlo(function(err,code,lines){\r\n            console.log('secure ehlo responded with code '+sys.inspect(code)+' and lines: '+sys.inspect(lines)+' and error '+sys.inspect(err));\r\n        });\r\n    });                                                     \r\n});\r\n```\r\n\r\nWhen I run that against a starttls-enabled server, I get the following error:\r\n\r\n```\r\nsecure ehlo responded with code undefined and lines: undefined and error [Error: syntax error parsing:�U��Z���v��R�(�����y��C;�\r\nm+ev�9�WK���dm��x�_߶}��������y��)�*hNHӻ?�4��o���?�▒�x@aH��b0�-Db�cz>\r\n                                                                    ��]\r\n```\r\n\r\nI need the ehlo response in order to determine which AUTH method to use since the 'greeting' event only returns the 'host' info and not the other '250' lines.\r\n\r\nPlease advise,\r\nShawn"},"comment":{"url":"https://api.github.com/repos/substack/node-smtp-protocol/issues/comments/156318751","html_url":"https://github.com/substack/node-smtp-protocol/issues/41#issuecomment-156318751","issue_url":"https://api.github.com/repos/substack/node-smtp-protocol/issues/41","id":156318751,"user":{"login":"kowsik","id":73841,"avatar_url":"https://avatars.githubusercontent.com/u/73841?v=3","gravatar_id":"","url":"https://api.github.com/users/kowsik","html_url":"https://github.com/kowsik","followers_url":"https://api.github.com/users/kowsik/followers","following_url":"https://api.github.com/users/kowsik/following{/other_user}","gists_url":"https://api.github.com/users/kowsik/gists{/gist_id}","starred_url":"https://api.github.com/users/kowsik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kowsik/subscriptions","organizations_url":"https://api.github.com/users/kowsik/orgs","repos_url":"https://api.github.com/users/kowsik/repos","events_url":"https://api.github.com/users/kowsik/events{/privacy}","received_events_url":"https://api.github.com/users/kowsik/received_events","type":"User","site_admin":false},"created_at":"2015-11-13T04:27:36Z","updated_at":"2015-11-13T04:27:36Z","body":"Well, hopefully third time's a charm. Anybody know why you get garbled binary response after the 'tls' event fires? From the binary gunk that spews, it looks like the TLS negotiation bits are still unread/unflushed in the stream."}}