Click here to Skip to main content
15,891,372 members
Home / Discussions / C#
   

C#

 
GeneralRe: Problem with threading Pin
leppie3-Feb-03 7:28
leppie3-Feb-03 7:28 
Generalconversion from long[] to byte[] Pin
Michal Januszczyk2-Feb-03 11:02
sussMichal Januszczyk2-Feb-03 11:02 
GeneralRe: conversion from long[] to byte[] Pin
David Stone2-Feb-03 12:06
sitebuilderDavid Stone2-Feb-03 12:06 
GeneralRe: conversion from long[] to byte[] Pin
Member 2540883-Feb-03 1:22
Member 2540883-Feb-03 1:22 
GeneralRe: conversion from long[] to byte[] Pin
Richard Deeming3-Feb-03 3:00
mveRichard Deeming3-Feb-03 3:00 
General.NET runtime environments Pin
Anonymous2-Feb-03 9:52
Anonymous2-Feb-03 9:52 
GeneralRe: .NET runtime environments Pin
Furty2-Feb-03 10:01
Furty2-Feb-03 10:01 
GeneralRe: .NET runtime environments Pin
Stephane Rodriguez.2-Feb-03 10:07
Stephane Rodriguez.2-Feb-03 10:07 
GeneralRe: .NET runtime environments Pin
Anonymous2-Feb-03 12:27
Anonymous2-Feb-03 12:27 
GeneralRe: .NET runtime environments Pin
ian mariano3-Feb-03 12:37
ian mariano3-Feb-03 12:37 
QuestionDetecting true or open or other type a font is? Pin
Member 1490692-Feb-03 7:23
Member 1490692-Feb-03 7:23 
QuestionAdding Controls to MenuItems? Pin
Jon Newman2-Feb-03 7:01
Jon Newman2-Feb-03 7:01 
AnswerRe: Adding Controls to MenuItems? Pin
Furty2-Feb-03 10:11
Furty2-Feb-03 10:11 
GeneralRe: Adding Controls to MenuItems? Pin
Jon Newman2-Feb-03 10:56
Jon Newman2-Feb-03 10:56 
GeneralRe: Adding Controls to MenuItems? Pin
Furty2-Feb-03 11:54
Furty2-Feb-03 11:54 
GeneralRe: Adding Controls to MenuItems? Pin
Jon Newman2-Feb-03 12:11
Jon Newman2-Feb-03 12:11 
GeneralRe: Adding Controls to MenuItems? Pin
Furty2-Feb-03 12:43
Furty2-Feb-03 12:43 
GeneralRe: Adding Controls to MenuItems? Pin
jtmtv182-Feb-03 14:36
jtmtv182-Feb-03 14:36 
GeneralSending Mail in C# Pin
Sassan Komeili Zadeh1-Feb-03 20:44
Sassan Komeili Zadeh1-Feb-03 20:44 
GeneralRe: Sending Mail in C# Pin
Vasudevan Deepak Kumar1-Feb-03 21:31
Vasudevan Deepak Kumar1-Feb-03 21:31 
GeneralRe: Sending Mail in C# Pin
leppie1-Feb-03 22:02
leppie1-Feb-03 22:02 
GeneralRe: Sending Mail in C# Pin
leppie1-Feb-03 22:10
leppie1-Feb-03 22:10 
GeneralRe: Sending Mail in C# Pin
Sassan Komeili Zadeh3-Feb-03 6:42
Sassan Komeili Zadeh3-Feb-03 6:42 
GeneralRe: Sending Mail in C# Pin
John Mautari11-Feb-03 5:36
John Mautari11-Feb-03 5:36 
You may use this class and add the following code to authenticate, just after sending the HELO command:

<br />
				//introduce ourselves<br />
				buf.Append("HELO ");<br />
				buf.Append(host);<br />
				con.SendCommand(buf.ToString());<br />
				con.GetReply(out response, out code);<br />
				buf.Length = 0;<br />
<br />
if(!AuthLoginPlain(con, user, password)) {<br />
// Failed<br />
con.Close();<br />
throw .... // throw an error<br />
}<br />
<br />
...<br />
<br />
<br />
		private bool AuthLoginPlain(SmtpConnection con, string user, string pass)<br />
		{<br />
			//Envia o comand AUTH LOGIN<br />
			StringBuilder buf = new StringBuilder();<br />
			byte [] b_user = System.Text.Encoding.ASCII.GetBytes(user);<br />
			byte [] b_pass = System.Text.Encoding.ASCII.GetBytes(pass);<br />
			string response;<br />
			string res;<br />
			string data;<br />
			int code;<br />
			buf.Append("AUTH LOGIN");<br />
			con.SendCommand(buf.ToString());<br />
			con.GetReply(out response, out code);<br />
			buf.Length = 0;<br />
			if(code == 334) <br />
			{<br />
				//pega ultima resposta menos o codigo de resposta<br />
				response = response.Substring(4);<br />
				res = System.Text.Encoding.ASCII.GetString(Convert.FromBase64String(response));<br />
				if(res == "Username:") <br />
				{<br />
					//envia o nome de <br />
					data = Convert.ToBase64String(b_user);<br />
					buf.Append(data);<br />
					con.SendCommand(buf.ToString());<br />
					con.GetReply(out response, out code);<br />
					buf.Length = 0;<br />
				}<br />
				if(code != 334) <br />
				{<br />
					return false;<br />
				}<br />
				response = response.Substring(4);<br />
				res = System.Text.Encoding.ASCII.GetString(Convert.FromBase64String(response));<br />
				if(res == "Password:") <br />
				{<br />
					// manda senha em plain<br />
					data = Convert.ToBase64String(b_pass);<br />
					buf.Append(data);<br />
					con.SendCommand(buf.ToString());<br />
					con.GetReply(out response, out code);<br />
					if(code != 235) <br />
					{<br />
						// falhou!<br />
						return false;<br />
					}<br />
					// se chegou até aqui, ok!<br />
					return true;<br />
				}<br />
			}<br />
			return false;<br />
		}<br />


Cheers,

John
QuestionComponents for spell checker and PDF generation ? Pin
Smitha Nishant1-Feb-03 17:36
protectorSmitha Nishant1-Feb-03 17:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.