Get No "Mail From" in the TcpClient

J

Jason Huang

Hi,

In my C# Windows form project, I can receieve the mail from the C# code,
however, it's EMPTY in the MAIL FROM:
Would someone give me some advice?

string Data;
byte[] szData;

TcpClient SmtpServ = new TcpClient(ServSMTP.Text,25);
NetworkStream NetStrm = SmtpServ.GetStream();
StreamReader RdStrm= new StreamReader(SmtpServ.GetStream());


Data = "RCPT TO: " + "<" + txtTo.Text + ">" + CRLF;

szData = System.Text.Encoding.Default.GetBytes(Data.ToCharArray());
NetStrm.Write(szData,0,szData.Length);


Thanks for help!

Jason
 
S

Stephany Young

With what you have posted, why would you expect to.

That looks like incomplete code for an SMTP Client, not an SMTP Server.
 
I

Ivar Lumi

SMTP session

S: greeting text
C: EHLO
S: OK
C: mail from: <>
S: response
C: RCPT TO:: <>
S: response
C: data
S: response
C: sends data
S: response
C: quit
S: response

Thas normal smtp sessiosn what you must follow, most server won't allow RCPT
TO: before all steps before it done.

Probably for you is to use some smtp client.
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

most probably you are not implementing the protocol correctly,
My suggestions are:
1- Simple use the class provided by the framework
2- Download some free smtp client from the net
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top