jstedfast / MailKit

A cross-platform .NET library for IMAP, POP3, and SMTP.

Home Page:http://www.mimekit.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

I get invalidstatuscode when custom SMTP server sends "250 OK" response for RCPT TO: C

SRGajjala opened this issue · comments

Describe the bug
I get invalidstatuscode when custom SMTP server sends "250 OK" response for RCPT TO: command

Platform (please complete the following information):

  • OS: Windows
  • .NET Runtime: [e.g. CoreCLR, Mono]

I implemented custom SMTP Server with SMTP commands.

I get invalidstatuscode for the server response "250 OK" to the RCPT TO command.

          private string cmd_rcpt(string cmdLine)
    {
        if (string.IsNullOrEmpty(this._mailFrom))
        {
            this._errCount++;
            return "503 Need MAIL before RCPT";
        }
        List<string> parts = parseCmdLine(cmdID.rcptTo, cmdLine);
        if (2 != parts.Count)
        {
            this._errCount++;
            return String.Format("501 {0} needs argument", parts[0]);
        }
        if (!checkMailAddr(parts[1]))
        {
            this._errCount++;
            return String.Format("553 Invalid address {0}", parts[1]);
        }

        if (!isLocalDomain(this._mailDom))
        {
            // relaying not allowed...
            this._errCount++;
            return "530 Relaying not allowed for policy reasons";
        }
        else if (!isLocalBox(this._mailBox, this._mailDom))
        {
            // unkown/invalid recipient
            this._errCount++;
            return String.Format("553 Unknown email address {0}", parts[1]);
        }

        this._rcptTo.Add(parts[1]);
        this._lastCmd = cmdID.rcptTo;
        //return string.Format("250 {0}... Recipient ok", parts[1]);
        return string.Format("250 OK");
       //return String.Format("553 Invalid address {0}", parts[1]);
        //return String.Empty;
        //return string.Format("250 {0}... Recipient ok", parts[1]);
        //return "250";
    }

You need to debug your own code