georgjf / SMTPtool

A slim .NET based UI tool to communicate with SMTP servers and to quickly compose, mail and remail messages
MIT License
54 stars 15 forks source link

Remail: duplicate MAIL FROM #2

Closed tkausl closed 6 years ago

tkausl commented 6 years ago

I'm trying to test a SMTP-Server implementation I'm working on. Unfortunately, the Remail-feature sends the MAIL FROM command twice and my server responds with an error. Whole log:

Okt 29 00:55:39 - Connecting to 127.0.0.1 on port25
<< 220 MailTrap ESMTP ready.
>> HELO MailTrap
<< 250 Go ahead
>> mail from: <georg@outsider.com>
<< 250 Go ahead
>> mail from: <georg@outsider.com>
<< 502 Duplicate MAIL
Okt 29 00:55:39 - Message sent sucessfully - duration -63644835339,36 seconds 
Connection closed
georgjf commented 6 years ago

Hi Tobias

That's true. I also noticed that some time ago. doublemailissue The Sendmail system I initially used for testing was not complaining about the double MAIL FROM. A fix for this will be included in the next version.

However, I have already corrected the behaviour in my local repo. You can find a pre release version here. Just replace the new binary with the old one.

You will also get a "Message not sent" response now, when there actually was a problem sending the mail.

Please let me know, if there are any further issues. Thank you.

Regards Georg

tkausl commented 6 years ago

Thanks for your quick response.

It does fix the duplicate MAIL FROM issue and the "Message sent sucessfully" issue, however, now it acts even weirder for me:

Okt 29 02:07:22 - Connecting to 127.0.0.1 on port25
<< 220 MailTrap ESMTP ready.
>> HELO MailTrap
<< 250 Go ahead
>> mail from: <georg@outsider.com>
<< 250 Go ahead
Okt 29 02:07:22 - Message not sent 
Connection closed

Edit: By the way, on the "Simple Mail" Tab it's working fine, not sure what the difference is.

georgjf commented 6 years ago

The Simple Mail Tab uses the .NET Mail library. For the Remail Tab I have written my own basic implementation of SMTP, in order to give the user a better insight of the actual commands being sent on the wire. I have to admit that this implementation is a bit rough and not too sophisticated.

When sending the MAIL FROM the system expects the response from the server to start with these strings: "250 2.1.0" or "250 fromAddress"

That was sufficient for my tests in combination with Sendmail, Postfix & Exchange. Hence I just left it like that.

I have changed that and the system should now know in what state of the sending process it currently is. Getting a "250" response after sending the MAIL FROM command now correctly results in sending out the RCPT TO.

You can find the new binary here. Let me know if there is another issue later on in the sending process.

Regards Georg

tkausl commented 6 years ago

It works, only one minor issue after the mail was sent:

[all the email data]
>> .
<< 250 Thank you.
Okt 30 10:40:14 - Message not sent 
Connection closed

But this isn't really a problem for me, the current executable works well, thank you for support and this awesome tool

georgjf commented 6 years ago

Happy to hear that it works now for you. That was just a quick & dirty fix. I will implement it properly in the next release. Thank you for the feedback :)

Regards Georg