1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

In Visual Basic how can you make a program that can log you in to your email?

Discussion in 'Visual Basic .NET' started by simpleonlinetest, Apr 24, 2010.

  1. simpleonlinetest

    simpleonlinetest Regular Member

    Joined:
    Feb 18, 2010
    Messages:
    208
    Likes Received:
    25
    I wanted to create a simple Visual Basic 2008 program that can log me into my email with a click of a button...what would a the code for the button look like?
     
  2. specopkirbs

    specopkirbs BANNED BANNED

    Joined:
    Nov 28, 2008
    Messages:
    920
    Likes Received:
    746
    im looking to do the same thing, could be quite useful
     
  3. sdtopensied

    sdtopensied Regular Member

    Joined:
    Sep 1, 2009
    Messages:
    211
    Likes Received:
    113
    Occupation:
    Software Developer
    Location:
    Western Hemisphere
    There are several ways to do this. However, none of them are simple enough to explain in a few lines (or in the amount of time I have at the moment). Check out a site like hxxp://www.codeproject.c0m (x=t, 0=o) and do a search on something like "VB email client"

    I'm sure someone has posted an article or maybe even an entire application that will give you some sample code to start from.

    Hope this helps...if it does, don't forget to his the thanks button :)

    -SDT
     
  4. voyevoda

    voyevoda Regular Member Premium Member

    Joined:
    Mar 21, 2010
    Messages:
    217
    Likes Received:
    97
    Location:
    Eastern Front
    It would connect to your provider over POP or IMAP (possibly TLS- or SSL-enabled if you care about security at all) and send your login credentials. It would then list the contents of the mailboxes associated with your account.
     
  5. smack

    smack Junior Member

    Joined:
    Feb 1, 2010
    Messages:
    182
    Likes Received:
    78
    Occupation:
    Software Engineer/Evil Genius
    Location:
    inside .NET
    yeah of course that's possible.

    you should be more specific though in your query.

    are you trying to log in to a webmail system, or a pop3/imap system?

    there's about a million different ways to skin this cat in vb.net
     
  6. cyrix

    cyrix Junior Member

    Joined:
    Sep 19, 2008
    Messages:
    179
    Likes Received:
    61
    Occupation:
    Full Time Internet Marketer\Developer
    Location:
    United States
    Easiest way would be to use a 3rd party POP\IMAP library like voyevoda suggested. Other option would be to use the web interface if they have one like smack suggested. Could do this with .Net's HTTPWebRequest Extension. Good luck man
     
  7. simpleonlinetest

    simpleonlinetest Regular Member

    Joined:
    Feb 18, 2010
    Messages:
    208
    Likes Received:
    25
    Gotcha......so here is the detailed info....

    I'm trying to create a program that is similiar to Rssbot...I need to know how to transfer the text I enter enter a text box in VB to the URL submit box of the Rss agregator site.....then code up a button in VB to press the submit button online.


    Got any ideas? Was thinking about using iMacros to create the scripts of each site then setup a variable in the script to use the text from the textbox in VB...
     
  8. smack

    smack Junior Member

    Joined:
    Feb 1, 2010
    Messages:
    182
    Likes Received:
    78
    Occupation:
    Software Engineer/Evil Genius
    Location:
    inside .NET
    as cryix mentioned HTTPWebrequest is probably the route you want to go.

    every time you use a web browser control, god kills a kitten.

    here are some links to get you started:

    Code:
    [FONT=Verdana][SIZE=3][URL]http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.aspx[/URL]
    [/SIZE][/FONT][FONT=Verdana][SIZE=3][URL]http://www.codeproject.com/KB/webservices/HttpWebRequest_Response.aspx[/URL][/SIZE][/FONT]
     
  9. Devilzhangout

    Devilzhangout Newbie

    Joined:
    Aug 13, 2010
    Messages:
    27
    Likes Received:
    0
    Occupation:
    Selling Yt accounts
    Home Page:
    its really easy man if u have vb knowledge :)
     
  10. faster

    faster Jr. VIP Jr. VIP Premium Member

    Joined:
    Jan 3, 2011
    Messages:
    1,730
    Likes Received:
    184
    Home Page:
    This is a simple things that you want.
    But this is long time if I give to you of your desired code.
    Please try to read the book and do your job.
     
  11. lwelch45

    lwelch45 Junior Member

    Joined:
    Mar 24, 2010
    Messages:
    135
    Likes Received:
    38
    Home Page:
    Well Im no big VB coder but I use this

    Code:
    Public Class Form1
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            'Part 1: Load Yahoo login page in Form_Load event  
            WebBrowser1.Navigate("https://login.yahoo.com/")
        End Sub
        Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
    
            'Part 2: Locate the Username TextBox and automatically input your username  
            '<INPUT class=yreg_ipt id=username maxLength=96 size=17 name=login>  
            Dim theElementCollection As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("Input")
            For Each curElement As HtmlElement In theElementCollection
                Dim controlName As String = curElement.GetAttribute("id").ToString
                If controlName = "username" Then
                    curElement.SetAttribute("Value", "your username")
                End If
            Next
    
            'Part 3: Locate the Password TextBox and automatically input your password  
            '<INPUT class=yreg_ipt id=passwd type=password maxLength=64 size=17 value="" name=passwd>  
            theElementCollection = WebBrowser1.Document.GetElementsByTagName("Input")
            For Each curElement As HtmlElement In theElementCollection
                Dim controlName As String = curElement.GetAttribute("id").ToString
                If controlName = "passwd" Then
                    curElement.SetAttribute("Value", "your email")
                End If
            Next
    
            'Part 4: Locate the "Sign In" Button and automatically click it  
            '<INPUT type=submit value="Sign In" name=.save>  
            theElementCollection = WebBrowser1.Document.GetElementsByTagName("Input")
            For Each curElement As HtmlElement In theElementCollection
                If curElement.GetAttribute("value").Equals("Sign In") Then
                    curElement.InvokeMember("click")
                    'Javascript has a click method for we need to invoke on the current submit button element.  
                End If
            Next
        End Sub
    End Class
     
  12. Wilson006

    Wilson006 Registered Member

    Joined:
    Jan 21, 2011
    Messages:
    95
    Likes Received:
    3
    Occupation:
    http://www.youtube.com/user/utubekaraoke
    Location:
    United States
    Good question <3
     
  13. ASPdotNET

    ASPdotNET Newbie

    Joined:
    Jan 31, 2011
    Messages:
    3
    Likes Received:
    2
    While WebRequest can be used, I suggest you take a look at Chilkat. There is a lot of error handling you can run into with WebRequest. Also if there's HTTPS involved its impossible to tell .net's framework not to look up a cert. With lots of threads, this can be a huge issue. Chilkat also fully supports SOCKS4/5, something lacking with WebRequest. Finally, async calls are extremely easy in Chilkat, something that involves delegates last I looked at WebRequest (though we are talking years ago)

    U can find examples of a POST request by googling "Chilkat HTTP POST VB". I'd hotlink to it but I am a new member and it won't let me.

    Download H-T-T-P-Fox (i cant type without -) for Firefox and let it sniff what the browser sends when u press post. Then simply use chilkat to mimic this.

    Hope I was of help
     
    • Thanks Thanks x 1
    Last edited: Jan 31, 2011
  14. shubhamm

    shubhamm Junior Member

    Joined:
    Jan 25, 2010
    Messages:
    107
    Likes Received:
    25
    Occupation:
    Developer
    Location:
    BHW
    u can do it by using HttpWebReqesut And GetElementByID
     
  15. masterwaldo

    masterwaldo Registered Member

    Joined:
    Jul 3, 2008
    Messages:
    95
    Likes Received:
    49
    Can you share the code? :)