Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hangs in SMTP Authenticate method using Amazon SES #232

Closed
cdmackie opened this issue Aug 24, 2015 · 1 comment
Closed

Hangs in SMTP Authenticate method using Amazon SES #232

cdmackie opened this issue Aug 24, 2015 · 1 comment

Comments

@cdmackie
Copy link

using (var smtp = new SmtpClient())
{
    smtp.Connect("email-smtp.us-east-1.amazonaws.com", 587, MailKit.Security.SecureSocketOptions.StartTlsWhenAvailable);
    smtp.Authenticate("my-ses-creds, "ses-creds-password");
}

The call to Authenticate hangs.

I turned on the ProtocolLogger and this is what I get.

Connected to smtp://email-smtp.us-east-1.amazonaws.com:587/
S: 220 email-smtp.amazonaws.com ESMTP SimpleEmailService-1157831919 SPo1Eh0XEnJZdv07GKHV
C: EHLO [192.168.0.5]
S: 250-email-smtp.amazonaws.com
S: 250-8BITMIME
S: 250-SIZE 10485760
S: 250-STARTTLS
S: 250-AUTH PLAIN LOGIN
S: 250 Ok
C: STARTTLS
S: 220 Ready to start TLS
C: EHLO [192.168.0.5]
S: 250-email-smtp.amazonaws.com
S: 250-8BITMIME
S: 250-SIZE 10485760
S: 250-STARTTLS
S: 250-AUTH PLAIN LOGIN
S: 250 Ok
C: AUTH PLAIN [my-encoded-credentials]==
S: 4

(it really ends at the S: 4)

Win 8.1 / VS 2012
MailKit 1.2.10.0

edit:

The issue is in SmtpStream::ReadResponse. ReadAhead() only gives it one byte (a "4") and so it gets into an infinite loop. Debugging it through doesn't always show the problem because it's timing related. Without spending too much time on what's going on, I changed ln 468 to if (memory.Length >= 0 || inputIndex == inputEnd) just so I could progress. The logic there can't seem to handle reading one byte at a time. Maybe ReadAhead should give it a whole line.

@jstedfast
Copy link
Owner

Thanks for the bug report and for narrowing it down!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants