Using a quick paste-in telnet script to test results in no spool files created and no forwarding taking place.
We have install E-Mailrelay v2 on several flavors of Windows server. It is set up to accept and foreward on connection close (start up bat file below). When using a quick telnet 'paste into command line' script, the SMTP connection goes fine but E-Mailrelay does not create the spool files and results in no email forwarded. If we add a few second pause into the test script before closing the connection with the QUIT, it works.
You can see in the log below that the SMTP connection is fine, but emailrelay reports 'no messages to send'. There are no spool files in the spool directory.
We have tested with AV disabled and no change.
Pausing before the QUIT and it always works.
-> startup bat file
start "emailrelay" "C:\Program Files\E-MailRelay\emailrelay.exe" --close-stderr --forward-on-disconnect --forward-to myrelay.myco.com:25 --interface 192.168.10.100 --log --log-file C:\ProgramData\E-MailRelay\emailrelay-log-%%d.txt --log-time --no-syslog --pid-file C:\ProgramData\E-MailRelay\emailrelay.pid --remote-clients --spool-dir C:\ProgramData\E-MailRelay\spool --verbose
-> test script
telnet 192.168.10.100 25
EHLO frog.legs
MAIL FROM:frog@frog.legs
RCPT TO:cat@cat.meow
DATA
sender:The Big Frog frog@frog.legs
to:cat@cat.meow
subject:CroAkies
Here is the message
That is all
.
QUIT
-> Log
emailrelay: 20190422.162425.511: info: smtp connection from 192.168.100.10:55449
emailrelay: 20190422.162425.511: info: tx>>: "220 myhost -- E-MailRelay V2.0 -- Service ready"
emailrelay: 20190422.162425.526: info: rx<<: "EHLO frog.legs"
emailrelay: 20190422.162425.526: info: tx>>: "250-myhost says hello\r\n250-VRFY\r\n250 8BITMIME"
emailrelay: 20190422.162425.542: info: rx<<: "MAIL FROM:frog@frog.legs"
emailrelay: 20190422.162425.542: info: content file: C:\ProgramData\E-MailRelay\spool\emailrelay.936.973582.10.content
emailrelay: 20190422.162425.542: info: tx>>: "250 OK"
emailrelay: 20190422.162425.573: info: rx<<: "RCPT TO:cat@cat.meow"
emailrelay: 20190422.162425.573: info: tx>>: "250 OK"
emailrelay: 20190422.162425.651: info: rx<<: "DATA"
emailrelay: 20190422.162425.651: info: tx>>: "354 start mail input -- end with <crlf>.<crlf>"
emailrelay: 20190422.162425.823: info: rx<<: [message content not logged]
emailrelay: 20190422.162425.823: info: rx<<: "."
emailrelay: 20190422.162425.823: info: envelope file: C:\ProgramData\E-MailRelay\spool\emailrelay.936.973582.10.envelope.new
emailrelay: 20190422.162425.823: info: rx<<: "QUIT"
emailrelay: 20190422.162425.823: info: tx>>: "221 closing connection"
emailrelay: 20190422.162425.823: info: smtp connection closed: smtp protocol done: 192.168.100.10:55449
emailrelay: 20190422.162425.823: info: forwarding: [client disconnect]
emailrelay: 20190422.162425.823: info: forwarding: no messages to send</crlf></crlf>
Thanks
I think it's just that you are not waiting for the acknowledgement of the end-of-text "." command; there is no "tx>>: 250 OK" in your log snippet between the "." and the QUIT.
I do see there is no 250 OK. I just don't know why the emailrelay listener does not issue the connection closing before the QUIT gets there. The past-script works without fail on other SMTP gateways (exchange). It just seems to be this past-in-script method. Otherwise, the relay is working as needed
By sending the end-of-text dot followed immediately by QUIT, without waiting, you are not following the SMTP protocol so you should not expect messages to be accepted reliably. As per RFC 2821 4.3.1: SMTP "is an alternating dialogue, controlled by the sender. [...] the sender MUST wait for this response before sending further commands". In the case of emailrelay the message transaction is aborted by the out-of-sequence QUIT and the uncommitted message files are deleted; the QUIT causes a disconnect that triggers the --forward-on-disconnect action, but there are no message files to forward.
Thanks for the follow up - that makes sense.
This issue has been resurrected as feature-request 17 ( https://sourceforge.net/p/emailrelay/feature-requests/17/ )