Solved

Accessing Webmail directly

Posted on 2000-03-04
23
679 Views
Last Modified: 2010-04-04
Is there any code which shows how to access Webmail (eg; hotmail) inbox directly.

Maybe using fpiette´s internet suite.

I want to check my Webmail without opening it using Explorer.

0
Comment
Question by:jmulder
  • 11
  • 11
23 Comments
 
LVL 1

Expert Comment

by:cobramania
ID: 2583061
As long as you know the smtp and pop3 server and you know the port the used, you can use SMTP component to access it.
And for hotmail i don't think you could access it coz it's for trial only if i'm not mistaken

And code for accessing web mail is same with accessing standard mailbox.

Hope this helps
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2583066
It is possible using TNMHTTP or F. Piettes equivalent component. But where do you want to store the response? Sending a request always returns an HTML page, just like you will get in a web browser.
0
 
LVL 1

Author Comment

by:jmulder
ID: 2607676
I want to access Webmail such as Hotmail without (i.e. not POP3 accounts) Sorry.

Re: Epsylon´s comments

I want to open my browser at the Hotmail inbox directly. Not the login screen.

I eventually want to download the inbox page and parse this to see what mail I´ve got without downloading it.

jmulder
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2607866
You have to automate the login sequence. How this has to be done depends on which webmail system you use.

If you look at the HTML-source of the login page your'll see a <form ...> tag somewhere like this:

<form name="form1" action="/cgi-bin/login.dll" >
  <input type="text" name="name">
  <br>
  <input type="password" name="password">
  <br>
  <input type="submit" name="Submit" value="Submit">
</form>


When a user clicks on 'submit' the browser 'post' the name and password to the webserver by calling the login.dll. The result will be sent back to your browser.

You can simulate this action with components like TNMHTTP (note: TNMHTTP does not support frames and some other things).
If you have Delphi 5, you can easily use TWebBrowser too.
0
 
LVL 1

Author Comment

by:jmulder
ID: 2615402
Dear Epsylon

This looks like what I want. I don´t know if I have TNMHTTP. I will look. I use D3.

I figured I could use one of fpiette´s internet components to send CGI data direct...I just don´t know how and then what to do with the response.

Jmulder
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2621603
If you use the THttpCli component from F.Piette the try the HttpTst demo.

To test it I took an ASP example that uses the post method, so you can try the HTTP demo right now:

http://www.learnasp.com/learn/formtextarea.asp


In the Http demo fill in the URL field like this:

http://www.learnasp.com/learn/test/FormTextAreaRespond.asp

And the data field like this:

shippingComments=This%20is%20a%20test!

Then click the Post button and see what happens.....


When you have to post multiple data fields then separate them with a '&':

username=myname&password=mypassword


Don't forget to use the https protocol when necessary.
0
 
LVL 1

Author Comment

by:jmulder
ID: 2622956
Dear Epsylon
I will try this asap. I don´t have a home connection. I have to bring floppy to CyberCafe ... hence the delays from my end.
To use the HTTPS do I just have to write  HTTPS instead of HTTP or is there something else to do. Also what do I put in Proxy field?
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2624690
HTTPS means that you open a secure connection. It's often used when you send passwords etc. And yes, use https instead of http.


Example:

https://www.somedomain.com/cgi-bin/login.dll


The proxy field is needed when you are connected to the Internet via a proxyserver, which is most likely not the case. Just leave it blank.
0
 
LVL 1

Author Comment

by:jmulder
ID: 2635681
Epsylon

I tried HTTPTST...(sorry for the long comment)

I use netaddress for mail, their login form looks as follows...

             <form name="loginform" onSubmit="SubmitLogin(); return true;" action="/tpl/Door/LoginPost" method="POST">
             <input type="hidden" name="LoginState" value="2">
             <input type="hidden" name="SuccessfulLogin" value="/tpl">
             <input type="hidden" name="NewServerName" value="www.netaddress.com">
             <input type="hidden" name="JavaScript" value="None">
             <input type="hidden" name="DomainID" value="4">
             <input type="hidden" name="NA31site" value="classic.netaddress.com">
             <input type="hidden" name="NA31port" value="80">

             <input type="text" size="16" name="UserID">
             <input type="password" size="16" name="passwd">
             <input type="submit" value="Login">
             <input type="checkbox" name="Expire_Cache" value="1">
             <input type="checkbox" name="Use_Cookie" value="1">

The SubmitLogin() function just sets the correct JavaScript version.

I have used various combinations of data including a complete line...

SuccessfulLogin=/tpl&NewServerName=www.netaddress.com&JavaScript=JScript1.0&DomainID=4&NA31site=classic.netaddress.com&NA31port=80&UserID=jtmulder&passwd=mypassword&Expire_Cache=1&Use_Cookie=1

and always get an error which says BadDomain back from netaddress. I am asumming that the data has to appear in the same order as appears in the form.

jmulder

0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2637091
Are the hidden parameters of the formalways the same? If not then things will become complicated.

But check this first:

I added the LoginState parameter and replaced a '/' with %47 (=url encoded):

LoginState=2&SuccessfulLogin=%47tpl&NewServerName=www.netaddress.com&JavaScript=JScript1.0&DomainID=4&NA31site=classic.netaddress.com&NA31port=80&UserID=jtmulder&passwd=mypassword&Expire_Cache=1&Use_Cookie=1


and the order *should* not be important. Don't forget to supply the entire url.
0
 
LVL 1

Author Comment

by:jmulder
ID: 2639578
Epsylon,

Oops, I forgot the LoginState.

I tried all this but I always get the same. As far as I see the login screen is always the same. I compared it with one I saved last year and there is no difference in code.

What makes me suspicious is that I get the same message even when I supply the wrong password. When I do this from the login screen I a message BadPass but with HTTPTST I still get BadDomain.

If you have HTTPTST you can see what I mean.

jmulder
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 13

Expert Comment

by:Epsylon
ID: 2641099
I entered the following:

URL:

http://www.netaddress.com/tpl/Door/LoginPost

Data:

LoginState=2&SuccessfulLogin=%47tpl&NewServerName=www.netaddress.com&JavaScript=JScript1.0&DomainID=4&NA31site=classic.netaddress.com&NA31port=80&UserID=jtmulder&passwd=mypassword&Expire_Cache=1&Use_Cookie=1


The I pressed the post button and got the following response:

<html>
<head>
<META HTTP-EQUIV="Refresh" CONTENT="0;URL=http://www.netaddress.com/tpl/Door/Terminated?Reason=BadPasswd">

</html>



Don't know what happens when I supply the right password.....
0
 
LVL 1

Author Comment

by:jmulder
ID: 2648808
Nearly there...

Oops again...I was using "Get"
This time I got...

<html>
<head>
<META HTTP-EQUIV="Refresh" CONTENT="0;URL=Gtpl/Door/506KTHQKE/Welcome">
</head>
</html>
This is what appears in the address bar when you log in using the browser.

Now I need to get this to open my browser. You can´t just ShellExecute this (http://www.netaddress.com/tpl/Door/506KTHQKE/Welcome) because the server replies termination...reason: Intrusion.

0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2650490
Shouldn't it be Gtpl and not tpl...?

http://www.netaddress.com/Gtpl/Door/506KTHQKE/Welcome
0
 
LVL 1

Author Comment

by:jmulder
ID: 2656538
Epsylon

That´s what I thought but this gives me an error - 13 which I think just means bad URL.

So I tried tpl instead because when you log in to Netaddress this is the URL you always end up with, not Gtpl.

I have have opened up a Netaddress account just to try this...

Username: expertsexchange
Password: expertsexchange

You´ll see what I mean.

PS: You already deserve the points for this even if we don´t get past this point but please don´t give up because I think we are close.
0
 
LVL 1

Author Comment

by:jmulder
ID: 2668599
I got your last message saying a lot goes on behind the scenes after login but this message has dissappeared?!

There is a program that does exactly what I want to do...it´s called AnyMail and is at:

http://www.tntsb.com/anymail/

I was reading their feedback (which I can´t find any more so I can´t quote exactly) and they had problems with Netaddress which had something to do with the way the pages are cached.

Don´t know what they meant but they sorted it.

jmulder

0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2678377
Still no luck here.....   :o(
0
 
LVL 1

Author Comment

by:jmulder
ID: 2679522
When Netaddress sends the lines:

<META HTTP-EQUIV="Refresh" CONTENT="0;URL=...

it sends it to the browser which it thinks sent the CGI data and this refreshes the same browser to new page does it not.

It may be possible to automate this process by having a local HTML document (login.html) which sends the login data automatically instead of waiting for user to press the LOGIN button.

Can forms be activated automatically?
Just a thought...


0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2684794
Well... it's possible to use TWebBrowser in you Delphi app but since you use Delphi 3 it's very difficult for me to get the job done. Another problem could be that not all computers have this object installed.
0
 
LVL 1

Author Comment

by:jmulder
ID: 2707518
What about just using Explorer directly. i.e have an HTML doc which activates the form automatically and just shell executing it to fire up explorer...I know it´s not exactly what I want but...

Send your next comment as an answer and I will give you the points. Answers can be graded.

You deserve it. If you find a way after this then please send it to me at jmulder@hotmail.com

0
 
LVL 13

Accepted Solution

by:
Epsylon earned 200 total points
ID: 2708851
Yes, that is possible but it won't be a Delphi question anymore  :o)

With javascript you can force to submit the form with the data and this script can be triggered by the onLoad event.

Would you like me to do do this?
0
 
LVL 1

Author Comment

by:jmulder
ID: 2711139
Yes please. It will have to do for now until we find a direct Delphi solution.

0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2714089
Ok, here it is:


----------- Login.htm -------------

<html>
<head>
<TITLE>Login</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>


<SCRIPT language="Javascript">
<!--
function SubmitLogin()
{
   var temp;
   document.loginform.SuccessfulLogin.value="/tpl";
   document.loginform.NewServerName.value="www.netaddress.com";
   document.loginform.JavaScript.value="JScript1.0";

  if (navigator.userAgent.indexOf("Mozilla/5.") != -1)
  {
   document.loginform.JavaScript.value="JavaScript1.2";
  }
  else if (navigator.userAgent.indexOf("Mozilla/4.") != -1)
  {
   document.loginform.JavaScript.value="JavaScript1.2";
  }
  else if (navigator.userAgent.indexOf("Mozilla/3.0") != -1)
  {
   document.loginform.JavaScript.value="JavaScript1.1";
  }
  else if (navigator.userAgent.indexOf("MSIE") != -1)
  {
   document.loginform.JavaScript.value="JScript1.0";
  }
  else if (navigator.userAgent.indexOf("Mozilla/2.0") != -1)
  {
   document.loginform.JavaScript.value="JavaScript1.0";
  }
}

function AutoLogin()
{
  SubmitLogin();
  loginform.submit();
}
//-->
</SCRIPT>

<body onLoad="AutoLogin()">
<form name="loginform" action="http://www.netaddress.com/tpl/Door/LoginPost" method="POST">
    <input type="hidden" name="LoginState" value="2">
    <input type="hidden" name="SuccessfulLogin" value="/tpl">
    <input type="hidden" name="NewServerName" value="www.netaddress.com">
    <input type="hidden" name="JavaScript" value="None">
    <input type="hidden" name="DomainID" value="4">
    <input type="hidden" name="NA31site" value="classic.netaddress.com">
    <input type="hidden" name="NA31port" value="80">
    <input type="hidden" name="UserID" value="expertsexchange">
    <input type="hidden" name="passwd" vlue value="expertsexchange">
</form>
</body>
</html>

-------------------------------

Start it from Delphi with:


uses ShellAPI;

ShellExecute(handle, 'open', 'Login.htm', '', '', SW_SHOWNORMAL);
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now