By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,182 Members | 1,344 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,182 IT Pros & Developers. It's quick & easy.

Get No "Mail From" in the TcpClient

P: n/a
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.ToCharA rray());
NetStrm.Write(szData,0,szData.Length);
Thanks for help!

Jason


Jan 24 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
With what you have posted, why would you expect to.

That looks like incomplete code for an SMTP Client, not an SMTP Server.
"Jason Huang" <Ja************@hotmail.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
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.ToCharA rray());
NetStrm.Write(szData,0,szData.Length);
Thanks for help!

Jason


Jan 24 '07 #2

P: n/a

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.

"Jason Huang" <Ja************@hotmail.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
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.ToCharA rray());
NetStrm.Write(szData,0,szData.Length);
Thanks for help!

Jason


Jan 24 '07 #3

P: n/a
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
--
Ignacio Machin
machin AT laceupsolutions com
Jan 24 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.