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.
so to do my test i call something like:
Anyone know who i can modify this to allow me to authenticate the user and pass?
Many Thanks,
Piercy
Code:
public ScriptingTelnet(string Address, int Port, int CommandTimeout) { address = Address; port = Port; timeout = CommandTimeout; } public bool Connect() { string []aliases; IPAddress[] addr; try { IPHostEntry IPHost = Dns.Resolve(address); aliases = IPHost.Aliases; addr = IPHost.AddressList; } catch { return false; } try { // Try a blocking connection to the server s = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); iep = new IPEndPoint(addr[0],port); s.Connect(iep) ; // If the connect worked, setup a callback to start listening for incoming data AsyncCallback recieveData = new AsyncCallback( OnRecievedData ); s.BeginReceive( m_byBuff, 0, m_byBuff.Length, SocketFlags.None, recieveData , s ); // All is good return true; } catch { // Something failed return false; } }
Code:
objActiveSolutions.ScriptingTelnet telnet = new objActiveSolutions.ScriptingTelnet(this.tbSMTPIP.Text, 25, 10); if(telnet.Connect()) { //do something }
Anyone know who i can modify this to allow me to authenticate the user and pass?
Many Thanks,
Piercy
Comment