Click here to Skip to main content
16,016,229 members
Home / Discussions / C#
   

C#

 
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 
AnswerRe: Components for spell checker and PDF generation ? Pin
jtmtv181-Feb-03 17:45
jtmtv181-Feb-03 17:45 
AnswerRe: Components for spell checker and PDF generation ? Pin
Vasudevan Deepak Kumar1-Feb-03 18:11
Vasudevan Deepak Kumar1-Feb-03 18:11 
GeneralFile Splitter Pin
Jassim Rahma1-Feb-03 17:32
Jassim Rahma1-Feb-03 17:32 
GeneralRe: File Splitter Pin
Vasudevan Deepak Kumar1-Feb-03 21:46
Vasudevan Deepak Kumar1-Feb-03 21:46 
Generalcoding styles Pin
jtmtv181-Feb-03 14:21
jtmtv181-Feb-03 14:21 
GeneralRe: coding styles Pin
Chris Austin1-Feb-03 16:02
Chris Austin1-Feb-03 16:02 
GeneralRe: coding styles Pin
Vasudevan Deepak Kumar1-Feb-03 18:13
Vasudevan Deepak Kumar1-Feb-03 18:13 
GeneralGetting crazy with Deny() Pin
marcossl1-Feb-03 13:06
marcossl1-Feb-03 13:06 
GeneralI am new here Pin
ThePhantomMenace1-Feb-03 9:14
ThePhantomMenace1-Feb-03 9:14 
GeneralRe: I am new here Pin
Christian Graus1-Feb-03 9:37
protectorChristian Graus1-Feb-03 9:37 
GeneralRe: I am new here Pin
Vasudevan Deepak Kumar1-Feb-03 18:15
Vasudevan Deepak Kumar1-Feb-03 18:15 
QuestionBest practice to build localizabled Applications ? Pin
Chris Richner1-Feb-03 6:40
Chris Richner1-Feb-03 6:40 
AnswerRe: Best practice to build localizabled Applications ? Pin
matthias s.1-Feb-03 9:11
matthias s.1-Feb-03 9:11 
GeneralRe: Best practice to build localizabled Applications ? Pin
Chris Richner1-Feb-03 9:38
Chris Richner1-Feb-03 9:38 
GeneralRe: Best practice to build localizabled Applications ? Pin
Chris Richner2-Feb-03 4:24
Chris Richner2-Feb-03 4:24 
GeneralRe: Best practice to build localizabled Applications ? Pin
ian mariano3-Feb-03 12:44
ian mariano3-Feb-03 12:44 

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.