Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8260807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:10:57+00:00 2026-06-08T03:10:57+00:00

I am currently working on creating my own SMTP server for a project I

  • 0

I am currently working on creating my own SMTP server for a project I am working on.

It is all pretty much working except for when I enter data, I get a response from something else that isn’t my program.

For doing the testing I am running my program which binds to IPAddress.Any and on port 25 for smtp. I am then using telnet from my local PC to test I am sending the correct responses. While doing this I turned on debug and stepping through the code to see what my program was doing.

  • When I connect I send a 220 with my domain name
  • When telnet sends the EHLO I send back a 250 with my domain name
  • From telnet I send MAIL FROM: someone@fromaddress.com and I send back 250 2.1.0 OK
  • From telnet I send RCPT TO: someone@toaddress.com and I send back 250 2.1.5 OK

Now this is where the strange things start happening,
From telnet I send DATA ready for the main email message and in the code I am supposed to be sending a 354 End data with <CR><LF>.<CR><LF> but instead I get a response of 354 please start mail input.

From all the steps before data visual studio went into the debug mode so I could step through but upon entering DATA visual studio didn’t respond as if my program never received anything and it instead went somewhere else.

I have no idea where this is coming from, I have no other SMTP server running on my PC.

Below is the code I am using

private void processSmtpReceived(TcpClient client)
        {
            stream = client.GetStream();
            reader = new StreamReader(stream);
            writer = new StreamWriter(stream);
            writer.NewLine = "\r\n";
            writer.AutoFlush = true;

            //writer.WriteLine("220 localhost -- Fake proxy server");
            string line = "";
            string message = "";
            string subject = "";
            bool readingData = false;
            if (client.Connected)
            {
                writer.WriteLine("220 localhost -- Fake proxy server");

                while ((line = reader.ReadLine()) != null && reader != null)
                {
                    line = line.Replace("\b", "");
                    if (readingData)
                    {
                        message += line;
                        if (line.Contains("Subject:"))
                        {
                            subject = line;
                        }
                        else if (line == ".")
                        {
                            writer.WriteLine("250 2.0.0 OK");
                            readingData = false;
                        }
                    }
                    else if (line.Contains("EHLO"))
                    {
                        writer.WriteLine("250 OK localhost-workgroup");
                    }
                    else if (line.Contains("MAIL FROM"))
                    {
                        writer.WriteLine("250 2.1.0 OK");
                    }
                    else if (line.Contains("RCPT TO"))
                    {
                        writer.WriteLine("250 2.1.5 OK");
                    }
                    else if (line.Contains("DATA"))
                    {
                        writer.WriteLine("354 End data with <CR><LF>.<CR><LF>");
                        readingData = true;
                    }
                    else if (line == ".")
                    {
                        writer.WriteLine("250 2.0.0 OK");
                    }
                    else if (line == "QUIT")
                    {
                        writer.WriteLine("221 2.0.0 Bye");
                        Console.WriteLine("Message: " + message);
                    }
                    else
                    {
                        writer.WriteLine("250 OK");
                    }
                    Console.WriteLine("Received: {0}", line);
                }
            }

As you can see from the code the response of start mail input is not in my code so no idea where this is coming from.

Thanks for any help you can provide

UPDATE
Have just found out something that is a bit weird. If I run the SMTP server and telnet on the same machine i.e. telnet localhost 25 it works correctly, and I get the 354 end with <CR><LF>.<CR><LF>, however if I telnet from a separate server i.e. telnet 192.168.1.74 25 then I get the 354 please start mail input. This is the same whether it is on Windows or Linux, I have no idea why it is generating this response as there is no where in the code that response is entered, and there is no smtp server running as when I stop my program and try and connect to telnet on port 25 I get the connection failed message.

UPDATE 2
As a test I changed the code so instead from telnet entering DATA for the message I enter MYTEST, when I used MYTEST my program receives the message that I am sending out and my program works as expected, its only when in the program I use DATA, which is what is expected for SMTP that my program doesn’t receive it, and I get the response from something else. I have done a network scan to see if there is anything else running as an SMTP server somewhere on my network but nothing is found.

UPDATE 3
I’ve also just found out that the problem I am having with sending DATA not being received by my program through telnet is only on Windows to remote Windows. If I telnet from a linux server to the smtp server running on Windows it works fine, its only if I am telneting from windows that I having the problem with the DATA command.

UPDATE 4
Have done a test and found that its not specific to Windows but my desktop and laptop development machines. I have installed a blank VM with Windows 7 and if I telnet to itself, i.e. localhost it works fine, if I telnet from my dev PC to the virtual machine then I get the unexpected response and it doesn’t go via my program. I guess there must be something on both my laptop and desktop that listens to smtp traffic in some way, not sure how as when my program isn’t running I’m not able to connect to port 25. The only thing I can think of is I have Symantec Norton 360 installed but I have disabled the firewall, antivirus and antispam and made no difference.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T03:10:59+00:00Added an answer on June 8, 2026 at 3:10 am

    Just found out the problem. I’ve proved that Symantec Norton 360 seems to take the input when DATA is sent via the smtp client. For some reason even disabling norton including the antispam doesn’t seem to make a difference. There is a section in the anti spam settings for protected ports and it has port 25 added but it doesn’t seem to let me want to remove the port. However, as my program allows the smtp port to be configurable, if I change it to a different port i.e. port 26 then my program works fine.

    Thanks for your help and suggestions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A project I'm currently working on requires the application to discover all audio tracks
I'm currently working on creating my own blog section.. After brainstorming a little while
I'm currently working on creating a Download Manager for Android. In order to optimize
I'm currently studying socket programming, i'm working on creating an application to use my
Currently working with the following package structure: /package __init__.py final.py /write __init__.py write.py /data
I am currently working on creating an import-based pipeline for my indie game using
I am currently working in a .Net project but from university I have also
I am currently working on creating a header file that acts like the standard
I am currently working on creating an overloaded function for the == operator. I
I am working on a personal project creating a punch clock in java. Since

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.