tekno7777
08-21-2004, 06:41 PM
Hey all, I have a question here.
I wanted to practice using the AUTH on mail servers to allow relaying.
I picked my hotmail mail server 'mail.hotmail.com' on port 25 for test purposes. From what i've read on the RFC, reading other posts, and everything else I could dig up, the idea is that you'd type
EHLO <blah>
and following your 220 ok response code, one would type
AUTH LOGIN
and press enter.
At this point, you will receive a base64-encoded message that will prompt you for your username and password.
(334 success code)
I encoded my login name in base64 and sent it, and I receive the same error each time:
501 cannot decode argument.
Unfortunately the RFC does not mention anything other than the fact one needs to simply send the username in base64 and then after a successful reasponse, you would do the same for your password. I cannot seem to make it past the login.
It would seem that perhaps the base64 function is incorrect, so i have supplied some sample code below that is right out of .net manuals
In addition, I have thought perhaps I was typing in the wrong login, and I tried both username as well as username@hotmail.com for login but both to no avail.
Any ideas what the situation could be?
BELOW is the basic code snippet:
Dim s As String
Dim b() As Byte
s = "michaellumpp@hotmail.com"
b = System.Text.UnicodeEncoding.Unicode.GetBytes(s)
s = vbNullString
s = System.Text.UnicodeEncoding.Unicode.GetString(b)
Dim client As New TcpClient("mail.hotmail.com", 25)
Dim ns As NetworkStream = client.GetStream()
Dim stdIn As New StreamReader(ns)
Dim stdOut As New StreamWriter(ns)
Dim responseCode As Int32
lstResults.Items.Add(stdIn.ReadLine()) 'this will show me the response
'EHLO part.
stdOut.WriteLine("EHLO " + Dns.GetHostName())
stdOut.Flush()
stdOut.WriteLine("AUTH LOGIN")
stdOut.Flush()
stdOut.WriteLine(System.Convert.ToBase64String(b))
stdOut.Flush()
I wanted to practice using the AUTH on mail servers to allow relaying.
I picked my hotmail mail server 'mail.hotmail.com' on port 25 for test purposes. From what i've read on the RFC, reading other posts, and everything else I could dig up, the idea is that you'd type
EHLO <blah>
and following your 220 ok response code, one would type
AUTH LOGIN
and press enter.
At this point, you will receive a base64-encoded message that will prompt you for your username and password.
(334 success code)
I encoded my login name in base64 and sent it, and I receive the same error each time:
501 cannot decode argument.
Unfortunately the RFC does not mention anything other than the fact one needs to simply send the username in base64 and then after a successful reasponse, you would do the same for your password. I cannot seem to make it past the login.
It would seem that perhaps the base64 function is incorrect, so i have supplied some sample code below that is right out of .net manuals
In addition, I have thought perhaps I was typing in the wrong login, and I tried both username as well as username@hotmail.com for login but both to no avail.
Any ideas what the situation could be?
BELOW is the basic code snippet:
Dim s As String
Dim b() As Byte
s = "michaellumpp@hotmail.com"
b = System.Text.UnicodeEncoding.Unicode.GetBytes(s)
s = vbNullString
s = System.Text.UnicodeEncoding.Unicode.GetString(b)
Dim client As New TcpClient("mail.hotmail.com", 25)
Dim ns As NetworkStream = client.GetStream()
Dim stdIn As New StreamReader(ns)
Dim stdOut As New StreamWriter(ns)
Dim responseCode As Int32
lstResults.Items.Add(stdIn.ReadLine()) 'this will show me the response
'EHLO part.
stdOut.WriteLine("EHLO " + Dns.GetHostName())
stdOut.Flush()
stdOut.WriteLine("AUTH LOGIN")
stdOut.Flush()
stdOut.WriteLine(System.Convert.ToBase64String(b))
stdOut.Flush()