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

220-hostname Unexpected response after connect #113

Open
LangeSebastian opened this issue Nov 8, 2024 · 3 comments
Open

220-hostname Unexpected response after connect #113

LangeSebastian opened this issue Nov 8, 2024 · 3 comments

Comments

@LangeSebastian
Copy link
Contributor

Unexpected server response "220-myhost.nodomain.io ESMTP Exim 4.98 #2 Wed, 30 Oct 2024 09:48:43 +0000" 220

Hi again,
we found an issue within the latest 2.99 and 3.x versions not being able to connect to some hosts on not correctly interpreting the response from servers. We confirmed this is working with older simplemail 2.x (not 2.99) and we are currently not sure what causes this in newer versions.
As mentioned we have it running in multiple systems and it works normally very well. Just some server responses seem to have issue on interpreting the 220 correctly. Same setup, just switching simplemail 2.3 with 3.1 and updating our interface will break the libraries functionality in this case, whereas mentioned most servers work fine.

The bulk email error is not displayed all times and connection can abort before too. We first thought we would require an earlier authentication but simplemail2 does the same order and it just works (tested on same machine with same settings).

Please notify us if we can help on analyzing any further.

`2024-10-30T09:45:13 Debug :0():Got response "220-myhost.nodomain.io ESMTP Exim 4.98 #2 Wed, 30 Oct 2024 09:45:13 +0000" expected 220

2024-10-30T09:45:13 Warning :0():Unexpected server response "220-myhost.nodomain.io ESMTP Exim 4.98 #2 Wed, 30 Oct 2024 09:45:13 +0000" 220

2024-10-30T09:45:13 Debug :0():readyRead 100

2024-10-30T09:45:43 Debug :0():Connecting to host encrypted "" 465

2024-10-30T09:45:43 Debug :0():stateChanged QAbstractSocket::HostLookupState ""

2024-10-30T09:45:43 Debug :0():stateChanged QAbstractSocket::ConnectingState ""

2024-10-30T09:45:43 Debug :0():stateChanged QAbstractSocket::ConnectedState ""

2024-10-30T09:45:43 Debug :0():connected 2 ""

2024-10-30T09:45:43 Debug :0():SocketError QAbstractSocket::SocketError(13) ""

2024-10-30T09:45:43 Debug :0():stateChanged QAbstractSocket::ClosingState ""

2024-10-30T09:45:43 Debug :0():stateChanged QAbstractSocket::UnconnectedState ""

2024-10-30T09:48:43 Debug :0():Connecting to host encrypted "http://myhost.nodomain.io/ " 465

2024-10-30T09:48:43 Debug :0():stateChanged QAbstractSocket::HostLookupState ""

2024-10-30T09:48:43 Debug :0():stateChanged QAbstractSocket::ConnectingState ""

2024-10-30T09:48:43 Debug :0():stateChanged QAbstractSocket::ConnectedState ""

2024-10-30T09:48:43 Debug :0():connected 2 ""

2024-10-30T09:48:43 Debug :0():readyRead 176

2024-10-30T09:48:43 Debug :0():Got response "220-myhost.nodomain.io ESMTP Exim 4.98 #2 Wed, 30 Oct 2024 09:48:43 +0000" expected 220

2024-10-30T09:48:43 Warning :0():Unexpected server response "220-myhost.nodomain.io ESMTP Exim 4.98 #2 Wed, 30 Oct 2024 09:48:43 +0000" 220

2024-10-30T09:48:43 Debug :0():readyRead 100

2024-10-30T09:52:03 Debug :0():SocketError QAbstractSocket::SocketError(20) "220-We do not authorize the use of this system to transport unsolicited, \r\n220 and/or bulk e-mail.\r\n"

2024-10-30T09:52:03 Debug :0():SocketError QAbstractSocket::RemoteHostClosedError ""

2024-10-30T09:52:03 Debug :0():stateChanged QAbstractSocket::ClosingState ""

2024-10-30T09:52:03 Debug :0():stateChanged QAbstractSocket::UnconnectedState ""`

(sorry for the strange formatting, it just would not accept the newlines and become unreadable)

@dantti
Copy link
Member

dantti commented Nov 8, 2024

please try git bisect since old versions worked

@LangeSebastian
Copy link
Contributor Author

LangeSebastian commented Jan 24, 2025

Hi again,

I did quite some analysis now, but the error is actually in the "new" interface using Server instead of Sender.

The issue is the parsing of the reponse code. In old Sender implementation the server response gets parsed multiple lines
220-Some Welcome message\r\n 220-More message stuf\r\n 220 Last line without minus

Now on the old implementation you loop over the response lines until there is no more data to read within
bool SenderPrivate::waitForResponse(int expectedCode)
whereas with the Server implementations only the first line gets parsed and a timeout occurs after even readyRead has another 100 characters to read

Debug:simplemail.server0readyRead 173
Debug:simplemail.server0Got response "220-abc.1234.top ESMTP Exim 4.96.2 #2 Thu, 23 Jan 2025 14:45:51 +0100" expected 220
Warning:simplemail.server0Unexpected server response "220-abc.1234.top ESMTP Exim 4.96.2 #2 Thu, 23 Jan 2025 14:45:51 +0100" 220
Debug:default0Server SmtpError: SimpleMail::Server::ServerError "220-abc.1234.top ESMTP Exim 4.96.2 #2 Thu, 23 Jan 2025 14:45:51 +0100"
Debug:simplemail.server0readyRead 100

I can safely send data with SimpleMail 2.3.0 and Sender::sendMail, but I get issues as soon as I switch for the Server::sendMail implementation.

Regards Sebastian

@LangeSebastian
Copy link
Contributor Author

I added an pull request to allow multiline responses 220- and 250- on waiting for 220 and 250 in parseResponseCode

#117

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