Results 1 to 37 of 37

Thread: VB6-pop3 email

Threaded View

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    May 2003
    Location
    Sydney
    Posts
    1,123

    VB6-pop3 email

    Hey, thanx to all the guys in here, i have done some code for retrieving email messages from a pop3 server. this is just a part of my new project. i just put it here so people can see what to do and not to fall into stupid traps i fell in. so here it goes.

    1. in a module, create these enums and types.
    VB Code:
    1. Public Enum POP_STATUS 'this is for the status of the pop getter
    2.     pop_Connect
    3.     pop_User
    4.     pop_Password
    5.     pop_Stat
    6.     pop_List
    7.     pop_Retr
    8.     pop_CRetr
    9.     pop_Delete
    10.     pop_Quit
    11. End Enum
    12.  
    13. Public Type MSG_STATS 'this is for the messages in the server
    14.     msg_Len As Long
    15.     msg_ThisLen As Long
    16.     msg_Body As String
    17.     msg_File As String
    18. End Type
    19.  
    20. Public Type POP_SERVER 'this is for the pop server settings
    21.     srv_Name As String
    22.     srv_Address As String
    23.     srv_Port As Long
    24.     srv_User As String
    25.     srv_Password As String
    26.     srv_Messages As Long
    27. End Type

    then there are some variable declarations, name it whatever u want but here is what i have done.
    VB Code:
    1. Public pStat As POP_STATUS
    2. Public myMsg() As MSG_STATS
    3. Public myServer As POP_SERVER
    4.  
    5.  
    6. Public mError As Long
    7. Public curMsg As Long
    8.  
    9. Public myMsgList As String
    10. Public myMsgListNum As Long
    11.  
    12. Public fso As New FileSystemObject' use this if u want to save data using the file system objects, or omit the 2 lines here.
    13. Public ***ile As TextStream

    now for the settings part, as we already have some settings put up as a datatype, we will access it here.
    VB Code:
    1. With myServer
    2.         .srv_Address = "<your pop3 server>"
    3.         .srv_Name = "<Name of your ISP, not needed explicitly>"
    4.         .srv_User = "<your pop3 username>"
    5.         .srv_Password = "<your pop3 password>"
    6.         .srv_Port = 110 'this is the default pop3 port.
    7.     End With

    and then the connection part. u know the drill
    VB Code:
    1. pStat = pop_Connect 'we set the status enum to connecting stage
    2.     With myServer
    3.         ws.Connect .srv_Address, .srv_Port
    4.     End With
    Last edited by mebhas; Dec 7th, 2005 at 10:59 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width