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

No anonymous authentication? #107

Open
lmcd opened this issue Jun 19, 2020 · 3 comments
Open

No anonymous authentication? #107

lmcd opened this issue Jun 19, 2020 · 3 comments

Comments

@lmcd
Copy link

lmcd commented Jun 19, 2020

I'm using an SMTP server that doesn't require authentication, though when Swift-SMTP attempts to authenticate with empty credentials, it fails.

I'm having no issues at all sending mail anonymously with the swaks tool.

How do I specify a credential-less SMTP configuration?

@sbeitzel
Copy link

Hmm. According to RFC 4954, if a client is providing an empty user name, the server must deny the authentication request. So, instead of using EHLO the anonymous connection should probably start with HELO.

@wnagrodzki
Copy link

If no authentication is required, client should not send AUTH command at all. I was able to send email via telnet with SMTP server that does not require authentication, listing below:

~ % telnet <redacted> 209
Trying <redacted>...
Connected to <redacted>.
Escape character is '^]'.
220 <redacted> Microsoft ESMTP MAIL Service ready at Tue, 4 Jan 2022 12:36:55 +0100
EHLO
250-<redacted> Hello <redacted>
250-SIZE 104857600
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-STARTTLS
250-X-ANONYMOUSTLS
250-AUTH NTLM
250-X-EXPS GSSAPI NTLM
250-8BITMIME
250-BINARYMIME
250-CHUNKING
250-XEXCH50
250-SMTPUTF8
250 XRDST
MAIL FROM:<redacted>
250 2.1.0 Sender OK
RCPT TO:<redacted>
250 2.1.5 Recipient OK
DATA
354 Start mail input; end with <CRLF>.<CRLF>
Subject: My Subject 

Email message.

.
250 2.6.0 <redacted> [InternalId=47369194308060, Hostname=<redacted>] 1085 bytes in 38.911, 0,027 KB/sec Queued mail for delivery

@sbeitzel
Copy link

The issue seems to be in SMTPSocket.init(...) -- specifically, the last two lines always try to authenticate, even if the server's response does not actually include a 250-AUTH line:

        let authMethod = try getAuthMethod(authMethods: authMethods, serverOptions: serverOptions, hostname: hostname)
        try login(authMethod: authMethod, email: email, password: password)

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

3 participants