[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 696
  • Last Modified:

Accessing Webmail directly

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
jmulder
Asked:
jmulder
  • 11
  • 11
1 Solution
 
cobramaniaCommented:
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
 
EpsylonCommented:
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
 
jmulderAuthor Commented:
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
EpsylonCommented:
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
 
jmulderAuthor Commented:
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
 
EpsylonCommented:
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
 
jmulderAuthor Commented:
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
 
EpsylonCommented:
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
 
jmulderAuthor Commented:
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
 
EpsylonCommented:
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
 
jmulderAuthor Commented:
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
 
EpsylonCommented:
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
 
jmulderAuthor Commented:
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
 
EpsylonCommented:
Shouldn't it be Gtpl and not tpl...?

http://www.netaddress.com/Gtpl/Door/506KTHQKE/Welcome
0
 
jmulderAuthor Commented:
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
 
jmulderAuthor Commented:
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
 
EpsylonCommented:
Still no luck here.....   :o(
0
 
jmulderAuthor Commented:
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
 
EpsylonCommented:
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
 
jmulderAuthor Commented:
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
 
EpsylonCommented:
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
 
jmulderAuthor Commented:
Yes please. It will have to do for now until we find a direct Delphi solution.

0
 
EpsylonCommented:
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 11
  • 11
Tackle projects and never again get stuck behind a technical roadblock.
Join Now