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

[c# winform] telnet, smtp server auth.

P: 77
I've already got some code in place which allows me to connect to a smtp server and verify the ip(just checks for a timeout.). anyway, i now need the app to check that the user and password its given has access to the smtp to send email. the code i have is as follows.
Expand|Select|Wrap|Line Numbers
  1. public ScriptingTelnet(string Address, int Port, int CommandTimeout)
  2.         {
  3.             address = Address;
  4.             port = Port;
  5.             timeout = CommandTimeout;
  6.         }
  7.  
  8.  
  9. public bool Connect()
  10.         {
  11.             string []aliases;
  12.             IPAddress[] addr;
  13.             try
  14.             {
  15.                 IPHostEntry IPHost = Dns.Resolve(address); 
  16.                 aliases = IPHost.Aliases; 
  17.                 addr = IPHost.AddressList; 
  18.             }
  19.             catch
  20.             {
  21.                 return false;
  22.             }
  23.  
  24.             try
  25.             {
  26.                 // Try a blocking connection to the server
  27.                 s                = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
  28.                 iep                = new IPEndPoint(addr[0],port);  
  29.                 s.Connect(iep) ;    
  30.  
  31.  
  32.                 // If the connect worked, setup a callback to start listening for incoming data
  33.                 AsyncCallback recieveData = new AsyncCallback( OnRecievedData );
  34.                 s.BeginReceive( m_byBuff, 0, m_byBuff.Length, SocketFlags.None, recieveData , s );
  35.  
  36.                 // All is good
  37.                 return true;
  38.             }
  39.             catch
  40.             {
  41.                 // Something failed
  42.                 return false;
  43.             }
  44.  
  45.         }
  46.  
so to do my test i call something like:
Expand|Select|Wrap|Line Numbers
  1.             objActiveSolutions.ScriptingTelnet telnet = new objActiveSolutions.ScriptingTelnet(this.tbSMTPIP.Text, 25, 10);
  2.             if(telnet.Connect())
  3.             {
  4.                 //do something
  5.             }
  6.  

Anyone know who i can modify this to allow me to authenticate the user and pass?

Many Thanks,
Piercy
Oct 17 '07 #1
Share this Question
Share on Google+
14 Replies


Plater
Expert 5K+
P: 7,872
If you are talking to the SMTP server, look up the SMTP commands.
Giving the "EHLO <your computer identity>"+[enter] should give you a response back telling you what AUTH types are available.
You can then send the correct sequence of commands to AUTH the user.

The rfc for the AUTH command extension can be found here
Oct 17 '07 #2

P: 77
If you are talking to the SMTP server, look up the SMTP commands.
Giving the "EHLO <your computer identity>"+[enter] should give you a response back telling you what AUTH types are available.
You can then send the correct sequence of commands to AUTH the user.

The rfc for the AUTH command extension can be found here
yes, i know the commands i need to use or i cna look them up. but im just not sure how i would send the commands to the server from the program.

im basically doing a check for a smtp server, my users use the application to send emails to people in a database.

now on settings up the app they admin will need to put in the smtp ip, username and password if required. the code i have above check the ip address responds. now i need it to authenticate and check it responds at the same time.

any ideas on how to send the commands from the app? just and ehlo or something then i can work out the auth and stuff myself.

Thanks once again,
Piercy
Oct 17 '07 #3

Plater
Expert 5K+
P: 7,872
In the program I made for smtp, I had an active socket connection the smtp server. (I presume that this is a real smtp server yes?)
On the socket I send the commands as ASCII strings

Format of EHLO:
Expand|Select|Wrap|Line Numbers
  1. string computername="PlaterComputer";
  2. string domainname="mydomain.com";
  3. string ehlostring= "EHLO "+computername+"."+domainname+"\r\n";
  4.  
Then the response back should follow the SMPT standards. It's possible the server will NOT list the available ATUH types (I believe it is supposed to though)

That link I send in the past message has example communications, i.e.:
C: EHLO mycomputer.mydomain.com
S: 250-mail.mydomain.com
S: 250 AUTH CRAM-MD5 DIGEST-MD5
That server will accept CRAM-MD5 and DIGEST-MD5 auth types.

Was that what you were looking for or were you looking for the actual how to send it using code thing?
Oct 17 '07 #4

P: 77
In the program I made for smtp, I had an active socket connection the smtp server. (I presume that this is a real smtp server yes?)
On the socket I send the commands as ASCII strings

Format of EHLO:
Expand|Select|Wrap|Line Numbers
  1. string computername="PlaterComputer";
  2. string domainname="mydomain.com";
  3. string ehlostring= "EHLO "+computername+"."+domainname+"\r\n";
  4.  
Then the response back should follow the SMPT standards. It's possible the server will NOT list the available ATUH types (I believe it is supposed to though)

That link I send in the past message has example communications, i.e.:

That server will accept CRAM-MD5 and DIGEST-MD5 auth types.

Was that what you were looking for or were you looking for the actual how to send it using code thing?

It doesn thave to use the code i provided. it would just be helpful if it did. im playing around with it now and the smtp server im using (yes it's real)
Expand|Select|Wrap|Line Numbers
  1. 250 - AUTH GSSAPI NTLM LOGIN
  2. 250 - AUTH =LOGIN
  3.  
thats part of what my server responds when ehlo it using cmd prmpt.

would you be able to give me the exact piece of code to send to the server. ie, i think the coding im using does this...

Socket s = new socket........
so the how would i send the commands soemthing like s.command?
Oct 17 '07 #5

Plater
Expert 5K+
P: 7,872
250 - AUTH GSSAPI NTLM LOGIN
250 - AUTH =LOGIN

So your server would prefer that use "LOGIN", but allows those other two types as well.

Well once you have you Socket created and connected (You can use the TcpClient object if you prefer)
So consider the following:
I have a function:
Expand|Select|Wrap|Line Numbers
  1. private void Write(TcpClient tcpc, byte[] buff)
  2.         {
  3.             try
  4.             {
  5.                 tcpc.GetStream().Write(buff, 0, buff.Length);
  6.             }
  7.             catch (IOException ioe)
  8.             {
  9.                 bool ignoreme = (ioe.Message == "");
  10.                 tcpc.Close();
  11.             }
  12.             catch (SocketException se)
  13.             {
  14.                 bool ignoreme = (se.Message == "");
  15.                 tcpc.Close();
  16.             }
  17.         }
  18.  
Then I could use:
Expand|Select|Wrap|Line Numbers
  1. string authstring="AUTH LOGIN\r\n";
  2. byte[] authbytes=Encoding.ASCII.GetBytes(authstring);
  3. //you need a byte[] to send on the socket
  4. // Encoding.ASCII is your friend
  5.  
  6. write(mytcpclient, authbytes);//send the command string
  7.  
  8. //you will then have to wait and read the response back
  9. //my actual "read" function used to read the response is pretty big
  10. //but I will include a little bit to get you started maybe:
  11. private string GetResponse(TcpClient tcpc)
  12. {
  13.    string gotin = "";
  14.    while (tcpc.GetStream().DataAvailable)
  15.    {
  16.       gotin += ((char)tcpc.GetStream().ReadByte());
  17.    }
  18.    return gotin;
  19. }
  20.  
You would then use the write/read functions to send you commands and verify the response.
Oct 17 '07 #6

P: 77
250 - AUTH GSSAPI NTLM LOGIN
250 - AUTH =LOGIN

So your server would prefer that use "LOGIN", but allows those other two types as well.

Well once you have you Socket created and connected (You can use the TcpClient object if you prefer)
So consider the following:
I have a function:
Expand|Select|Wrap|Line Numbers
  1. private void Write(TcpClient tcpc, byte[] buff)
  2.         {
  3.             try
  4.             {
  5.                 tcpc.GetStream().Write(buff, 0, buff.Length);
  6.             }
  7.             catch (IOException ioe)
  8.             {
  9.                 bool ignoreme = (ioe.Message == "");
  10.                 tcpc.Close();
  11.             }
  12.             catch (SocketException se)
  13.             {
  14.                 bool ignoreme = (se.Message == "");
  15.                 tcpc.Close();
  16.             }
  17.         }
  18.  
Then I could use:
Expand|Select|Wrap|Line Numbers
  1. string authstring="AUTH LOGIN\r\n";
  2. byte[] authbytes=Encoding.ASCII.GetBytes(authstring);
  3. //you need a byte[] to send on the socket
  4. // Encoding.ASCII is your friend
  5.  
  6. write(mytcpclient, authbytes);//send the command string
  7.  
  8. //you will then have to wait and read the response back
  9. //my actual "read" function used to read the response is pretty big
  10. //but I will include a little bit to get you started maybe:
  11. private string GetResponse(TcpClient tcpc)
  12. {
  13.    string gotin = "";
  14.    while (tcpc.GetStream().DataAvailable)
  15.    {
  16.       gotin += ((char)tcpc.GetStream().ReadByte());
  17.    }
  18.    return gotin;
  19. }
  20.  
You would then use the write/read functions to send you commands and verify the response.

right, im feeling like an idiot at the moment... lol... anyway, this is the code i had and it seems to contain all the information i need.. not definate but i think it does.

Expand|Select|Wrap|Line Numbers
  1. using System;
  2. using System.Net;
  3. using System.Net.Sockets;
  4. using System.Text;
  5. using System.IO;
  6. using System.Threading ;
  7.  
  8. namespace objActiveSolutions
  9. {
  10.     /// <summary>
  11.     /// Summary description for clsScriptingTelnet.
  12.     /// </summary>
  13.     public class ScriptingTelnet
  14.     {
  15.         private IPEndPoint iep ;
  16.         private AsyncCallback callbackProc;
  17.         private string address ;
  18.         private int port ;
  19.         private int timeout;
  20.         private Socket s ;
  21.         Byte[] m_byBuff = new Byte[32767];
  22.         private string strWorkingData = "";                    // Holds everything received from the server since our last processing
  23.         private string strFullLog = "";
  24.  
  25.         public ScriptingTelnet(string Address, int Port, int CommandTimeout)
  26.         {
  27.             address = Address;
  28.             port = Port;
  29.             timeout = CommandTimeout;
  30.         }
  31.  
  32.  
  33.         private void OnRecievedData( IAsyncResult ar )
  34.         {
  35.             // Get The connection socket from the callback
  36.             Socket sock = (Socket)ar.AsyncState;
  37.  
  38.             // Get The data , if any
  39.             int nBytesRec = sock.EndReceive( ar );        
  40.  
  41.             if( nBytesRec > 0 )
  42.             {
  43.                 // Decode the received data
  44.                 string sRecieved = CleanDisplay(Encoding.ASCII.GetString( m_byBuff, 0, nBytesRec ));
  45.  
  46.                 // Write out the data
  47.                 if (sRecieved.IndexOf("[c") != -1) Negotiate(1);
  48.                 if (sRecieved.IndexOf("[6n") != -1) Negotiate(2);
  49.  
  50.                 Console.WriteLine(sRecieved);
  51.                 strWorkingData += sRecieved;
  52.                 strFullLog += sRecieved;
  53.  
  54.  
  55.                 // Launch another callback to listen for data
  56.                 AsyncCallback recieveData = new AsyncCallback(OnRecievedData);
  57.                 sock.BeginReceive( m_byBuff, 0, m_byBuff.Length, SocketFlags.None, recieveData , sock );
  58.  
  59.             }
  60.             else
  61.             {
  62.                 // If no data was recieved then the connection is probably dead
  63.                 Console.WriteLine( "Disconnected", sock.RemoteEndPoint );
  64.                 sock.Shutdown( SocketShutdown.Both );
  65.                 sock.Close();
  66.                 //Application.Exit();
  67.             }
  68.         }
  69.  
  70.         private void DoSend(string strText)
  71.         {
  72.             try
  73.             {
  74.                 Byte[] smk = new Byte[strText.Length];
  75.                 for ( int i=0; i < strText.Length ; i++)
  76.                 {
  77.                     Byte ss = Convert.ToByte(strText[i]);
  78.                     smk[i] = ss ;
  79.                 }
  80.  
  81.                 s.Send(smk,0 , smk.Length , SocketFlags.None);
  82.             }
  83.             catch
  84.             {
  85.                 //MessageBox.Show("ERROR IN RESPOND OPTIONS");
  86.             }
  87.         }
  88.  
  89.         private void Negotiate(int WhichPart)
  90.         {
  91.             StringBuilder x;
  92.             string neg;
  93.             if (WhichPart == 1)
  94.             {
  95.                 x = new StringBuilder();
  96.                 x.Append ((char)27);
  97.                 x.Append ((char)91);
  98.                 x.Append ((char)63);
  99.                 x.Append ((char)49);
  100.                 x.Append ((char)59);
  101.                 x.Append ((char)50);
  102.                 x.Append ((char)99);
  103.                 neg =  x.ToString();
  104.             }
  105.             else
  106.             {
  107.  
  108.                 x = new StringBuilder();
  109.                 x.Append ((char)27);
  110.                 x.Append ((char)91);
  111.                 x.Append ((char)50);
  112.                 x.Append ((char)52);
  113.                 x.Append ((char)59);
  114.                 x.Append ((char)56);
  115.                 x.Append ((char)48);
  116.                 x.Append ((char)82);
  117.                 neg = x.ToString();
  118.             }
  119.             SendMessage(neg,true);
  120.         }
  121.  
  122.         private string CleanDisplay(string input)
  123.         {
  124.  
  125.             input = input.Replace("(0x (B","|");
  126.             input = input.Replace("(0 x(B","|");
  127.             input = input.Replace(")0=>","");
  128.             input = input.Replace(">","");
  129.             input = input.Replace("7","[");
  130.             input = input.Replace("*8","]");
  131.             input = input.Replace("","");
  132.             return input;
  133.         }
  134.  
  135.  
  136.  
  137.  
  138.         /// <summary>
  139.         /// Connects to the telnet server.
  140.         /// </summary>
  141.         /// <returns>True upon connection, False if connection fails</returns>
  142.         public bool Connect()
  143.         {
  144.             string []aliases;
  145.             IPAddress[] addr;
  146.             try
  147.             {
  148.                 IPHostEntry IPHost = Dns.Resolve(address); 
  149.                 aliases = IPHost.Aliases; 
  150.                 addr = IPHost.AddressList; 
  151.             }
  152.             catch
  153.             {
  154.                 return false;
  155.             }
  156.  
  157.             try
  158.             {
  159.                 // Try a blocking connection to the server
  160.                 s                = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
  161.                 iep                = new IPEndPoint(addr[0],port);  
  162.                 s.Connect(iep) ;    
  163.  
  164.  
  165.                 // If the connect worked, setup a callback to start listening for incoming data
  166.                 AsyncCallback recieveData = new AsyncCallback( OnRecievedData );
  167.                 s.BeginReceive( m_byBuff, 0, m_byBuff.Length, SocketFlags.None, recieveData , s );
  168.  
  169.                 // All is good
  170.                 return true;
  171.             }
  172.             catch
  173.             {
  174.                 // Something failed
  175.                 return false;
  176.             }
  177.  
  178.         }
  179.  
  180.  
  181.         public void Disconnect()
  182.         {
  183.             if (s.Connected) s.Close();
  184.         }
  185.  
  186.         /// <summary>
  187.         /// Waits for a specific string to be found in the stream from the server
  188.         /// </summary>
  189.         /// <param name="DataToWaitFor">The string to wait for</param>
  190.         /// <returns>Always returns 0 once the string has been found</returns>
  191.         public int WaitFor(string DataToWaitFor)
  192.         {
  193.             // Get the starting time
  194.             long lngStart = DateTime.Now.AddSeconds(this.timeout).Ticks;
  195.             long lngCurTime = 0;
  196.  
  197.             while (strWorkingData.ToLower().IndexOf(DataToWaitFor.ToLower()) == -1)
  198.             {
  199.                 // Timeout logic
  200.                 lngCurTime = DateTime.Now.Ticks;
  201.                 if (lngCurTime > lngStart)
  202.                 {
  203.                     throw new Exception("Timed Out waiting for : " + DataToWaitFor);
  204.                 }
  205.                 Thread.Sleep(1);
  206.             }
  207.             strWorkingData = "";
  208.             return 0;
  209.         }
  210.  
  211.  
  212.         /// <summary>
  213.         /// Waits for one of several possible strings to be found in the stream from the server
  214.         /// </summary>
  215.         /// <param name="DataToWaitFor">A delimited list of strings to wait for</param>
  216.         /// <param name="BreakCharacters">The character to break the delimited string with</param>
  217.         /// <returns>The index (zero based) of the value in the delimited list which was matched</returns>
  218.         public int WaitFor(string DataToWaitFor,string BreakCharacter)
  219.         {
  220.             // Get the starting time
  221.             long lngStart = DateTime.Now.AddSeconds(this.timeout).Ticks;
  222.             long lngCurTime = 0;
  223.  
  224.             string[] Breaks = DataToWaitFor.Split(BreakCharacter.ToCharArray());
  225.             int intReturn = -1;
  226.  
  227.             while (intReturn == -1)
  228.             {
  229.                 // Timeout logic
  230.                 lngCurTime = DateTime.Now.Ticks;
  231.                 if (lngCurTime > lngStart)
  232.                 {
  233.                     throw new Exception("Timed Out waiting for : " + DataToWaitFor);
  234.                 }
  235.  
  236.                 Thread.Sleep(1);
  237.                 for (int i = 0 ; i < Breaks.Length ; i++)
  238.                 {
  239.                     if (strWorkingData.ToLower().IndexOf(Breaks[i].ToLower()) != -1)
  240.                     {
  241.                         intReturn = i ;
  242.                     }
  243.                 }
  244.             }
  245.             return intReturn;
  246.  
  247.         }
  248.  
  249.  
  250.         /// <summary>
  251.         /// Sends a message to the server
  252.         /// </summary>
  253.         /// <param name="Message">The message to send to the server</param>
  254.         /// <param name="SuppressCarriageReturn">True if you do not want to end the message with a carriage return</param>
  255.         public void SendMessage(string Message, bool SuppressCarriageReturn)
  256.         {
  257.             strFullLog += "\r\nSENDING DATA ====> " + Message.ToUpper() + "\r\n";
  258.             Console.WriteLine("SENDING DATA ====> " + Message.ToUpper());
  259.  
  260.             if (! SuppressCarriageReturn)
  261.             {
  262.                 DoSend(Message + "\r");
  263.             }
  264.             else
  265.             {
  266.                 DoSend(Message);
  267.             }
  268.         }
  269.  
  270.  
  271.         /// <summary>
  272.         /// Sends a message to the server, automatically appending a carriage return to it
  273.         /// </summary>
  274.         /// <param name="Message">The message to send to the server</param>
  275.         public void SendMessage(string Message)
  276.         {
  277.             strFullLog += "\r\nSENDING DATA ====> " + Message.ToUpper() + "\r\n";
  278.             Console.WriteLine("SENDING DATA ====> " + Message.ToUpper());
  279.  
  280.             DoSend(Message + "\r");
  281.         }
  282.  
  283.  
  284.         /// <summary>
  285.         /// Waits for a specific string to be found in the stream from the server.
  286.         /// Once that string is found, sends a message to the server
  287.         /// </summary>
  288.         /// <param name="WaitFor">The string to be found in the server stream</param>
  289.         /// <param name="Message">The message to send to the server</param>
  290.         /// <returns>Returns true once the string has been found, and the message has been sent</returns>
  291.         public void WaitAndSend(string WaitFor,string Message)
  292.         {
  293.             this.WaitFor(WaitFor);
  294.             SendMessage(Message);
  295.  
  296.  
  297.         }
  298.  
  299.  
  300.         /// <summary>
  301.         /// Sends a message to the server, and waits until the designated
  302.         /// response is received
  303.         /// </summary>
  304.         /// <param name="Message">The message to send to the server</param>
  305.         /// <param name="WaitFor">The response to wait for</param>
  306.         /// <returns>True if the process was successful</returns>
  307.         public string SendAndWait(string Message, string WaitFor)
  308.         {
  309.  
  310.             SendMessage(Message);
  311.             this.WaitFor(WaitFor);
  312.             return strWorkingData;
  313.         }
  314.  
  315.  
  316.  
  317.         public int SendAndWait(string Message, string WaitFor, string BreakCharacter)
  318.         {
  319.             SendMessage(Message);
  320.             int t = this.WaitFor(WaitFor,BreakCharacter);
  321.             return t;
  322.         }
  323.  
  324.  
  325.         /// <summary>
  326.         /// A full log of session activity
  327.         /// </summary>
  328.         public string SessionLog
  329.         {
  330.             get 
  331.             {
  332.                 return strFullLog;
  333.             }
  334.         }
  335.  
  336.  
  337.         /// <summary>
  338.         /// Clears all data in the session log
  339.         /// </summary>
  340.         public void ClearSessionLog()
  341.         {
  342.             strFullLog = "";
  343.         }
  344.  
  345.  
  346.         /// <summary>
  347.         /// Searches for two strings in the session log, and if both are found, returns
  348.         /// all the data between them.
  349.         /// </summary>
  350.         /// <param name="StartingString">The first string to find</param>
  351.         /// <param name="EndingString">The second string to find</param>
  352.         /// <param name="ReturnIfNotFound">The string to be returned if a match is not found</param>
  353.         /// <returns>All the data between the end of the starting string and the beginning of the end string</returns>
  354.         public string FindStringBetween(string StartingString, string EndingString, string ReturnIfNotFound)
  355.         {
  356.             int intStart;
  357.             int intEnd;
  358.  
  359.             intStart = strFullLog.ToLower().IndexOf(StartingString.ToLower());
  360.             if (intStart == -1)
  361.             {
  362.                 return ReturnIfNotFound;
  363.             }
  364.             intStart += StartingString.Length;
  365.  
  366.             intEnd = strFullLog.ToLower().IndexOf(EndingString.ToLower(),intStart);
  367.  
  368.             if (intEnd == -1)
  369.             {
  370.                 // The string was not found
  371.                 return ReturnIfNotFound;
  372.             }
  373.  
  374.             // The string was found, let's clean it up and return it
  375.             return strFullLog.Substring(intStart, intEnd-intStart).Trim();
  376.         }
  377.  
  378.  
  379.     }
  380. }
  381.  
  382.  
i know this is a lot of code to paste, i did look for a online code dump to make it easier but couldnt find one.

would you be able to give me a quick example (using this if you can) on how to AUTH to a server preferably in the login encoding and/or a way to check for the auth the server requires and auth usign that(because thats the eventual need).

Thanks you very much, youve been a big help... even though i havent got my result yet im undertsanding it alot more.

Thanks,
Piercy
Oct 17 '07 #7

Plater
Expert 5K+
P: 7,872
Well I think you can do this:
Expand|Select|Wrap|Line Numbers
  1. string authstart="AUTH LOGIN\r\n";
  2. SendMessage(authstart,true);
  3. //you need a "\r\n" I think, maybe not, whatever though
  4.  
Now the problem is, you don't know what the response will be that you're waiting for, other then it will start with a 3-digit number and end with a "\r" or "\r\n".

It didn't look like you had a way to read a response and process it. The AUTH types require you to examine the reply to determine your response.

Appendix B: A LOGIN SMTP AUTH Conversation
A LOGIN SMTP Authentication conversation looks something like the following (after the mail server has indicated its support for the LOGIN mechanism):


C: AUTH LOGIN
S: 334 VXNlcm5hbWU6
C: d2VsZG9u
S: 334 UGFzc3dvcmQ6
C: dzNsZDBu
S: 235 2.0.0 OK Authenticated

Lines 2-5 of the conversation contain base64-encoded information. The same conversation, with base64 strings decoded, reads:


C: AUTH LOGIN
S: 334 Username:
C: weldon
S: 334 Password:
C: w3ld0n
S: 235 2.0.0 OK Authenticated
And the Convert object has .ToBase64String() ability for you.
Oct 17 '07 #8

P: 77
Well I think you can do this:
Expand|Select|Wrap|Line Numbers
  1. string authstart="AUTH LOGIN\r\n";
  2. SendMessage(authstart,true);
  3. //you need a "\r\n" I think, maybe not, whatever though
  4.  
Now the problem is, you don't know what the response will be that you're waiting for, other then it will start with a 3-digit number and end with a "\r" or "\r\n".

It didn't look like you had a way to read a response and process it. The AUTH types require you to examine the reply to determine your response.



And the Convert object has .ToBase64String() ability for you.
you still need to use the econding .ascii.getbytes because Convet.ToBase64String needs it in byte[] form. anyway, thats a greta help. tells em what to do really well. im still stuck with how i verify that connection. after all thats what its all about. some sort fo command i would need to be auth for for it to work? would i still need to be abel to return something from the server to verify the conenction?

or any other possible ways to verify the username and password against the ipaddress?
Oct 17 '07 #9

Plater
Expert 5K+
P: 7,872
Some servers have a VRFY command, but it's been my experiance that very few implement it.

Other than connecting to the smtp server and running the AUTH command sequence, I don't know of any way to validate username and passwords against a mail server.
Oct 17 '07 #10

P: 77
Some servers have a VRFY command, but it's been my experiance that very few implement it.

Other than connecting to the smtp server and running the AUTH command sequence, I don't know of any way to validate username and passwords against a mail server.

ok, looks like my client will have to go without the verification feature. ill verify theres a smtp server there then its there own job to make sure they give my the correct username and password.

Thanks very much for your help. even though id dint get the result i wanted i learnt a lot while doing it.

Thanks once again,
Piercy
Oct 17 '07 #11

Plater
Expert 5K+
P: 7,872
Are you not allowed to modify the code you provided to me?
It might be possible for you to simple "add in" the response reading functions that you need.
Oct 17 '07 #12

P: 77
Are you not allowed to modify the code you provided to me?
It might be possible for you to simple "add in" the response reading functions that you need.
i can modify it all i wish. also, the s3xy person next to me(lol).. recomended calling a hidden command prompt using the system.diagnostics namespace.

have you got any ideas for modifying that code then?

THanks,
Piercy
Oct 17 '07 #13

Plater
Expert 5K+
P: 7,872
Well what you would need is a "readline" from the response stream.and then have access to everything up till that point.
All server responses start with 3digits and end with the newline terminator.
If you could find a way to get at that it might work.
Oct 17 '07 #14

P: 77
edit: going to post ina enw thread as its a totally different problem now.. thanks for your help.
Oct 23 '07 #15

Post your reply

Sign in to post your reply or Sign up for a free account.