Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
tariq  
#1 Posted : Thursday, January 1, 2015 6:49:54 PM(UTC)
tariq

Rank: Newbie

Groups: Registered
Joined: 1/1/2015(UTC)
Posts: 7
Bahrain
Location: riffa

hi everybody everybody
I have used this wonderful tool via vb6

https://www.emailarchite...et/eagetmail/ex/b/7.aspx
I get all inbox email , but I not get the sent Email

Is it possible to get the sent Email ?

Is it possible to provide me the code vb6 ?

Thank you very much

Edited by moderator Wednesday, January 14, 2015 10:32:41 PM(UTC)  | Reason: for better search

ivan  
#2 Posted : Thursday, January 1, 2015 7:19:38 PM(UTC)
ivan

Rank: Administration

Groups: Administrators
Joined: 11/11/2010(UTC)
Posts: 1,013

Thanks: 9 times
Was thanked: 41 time(s) in 41 post(s)
hi, you can refer to imap_full.vb6 in eagetmail installation path, it can retrieve emails from any folder.
tariq  
#3 Posted : Thursday, January 1, 2015 10:22:17 PM(UTC)
tariq

Rank: Newbie

Groups: Registered
Joined: 1/1/2015(UTC)
Posts: 7
Bahrain
Location: riffa

Thank you for the reply Ivan
I have tried it, but until now I did not get what I want
Do you have links that can be used
In this code really what I want to design a program
But needs to be edit in
Quote:
oClient.GetMailInfosParam.SenderContains = "?@efax.com.bh"

to Retrieve all sent Email (outbox) or inbox

Code:
Public Sub ReceiveMail( _
ByVal sServer As String, _
ByVal sUserName As String, _
ByVal sPassword As String, _
ByVal bSSLConnection As Boolean)
    
    Const MailServerPop3 = 0
    Const MailServerImap4 = 1
    Const MailServerEWS = 2
    Const MailServerDAV = 3

    Const GetMailInfos_All = 1
    Const GetMailInfos_NewOnly = 2
    Const GetMailInfos_ReadOnly = 4
    Const GetMailInfos_SeqRange = 8
    Const GetMailInfos_UIDRange = 16
    Const GetMailInfos_PR_ENTRYID = 32
    Const GetMailInfos_DateRange = 64
    Const GetMailInfos_OrderByDateTime = 128

    'For evaluation usage, please use "TryIt" as the license code, otherwise the
    '"invalid license code" exception will be thrown. However, the object will expire in 1-2 months, then
    '"trial version expired" exception will be thrown.
    Dim oClient As New EAGetMailObjLib.MailClient
    oClient.LicenseCode = "TryIt"
    
    'To receive email with Exchange Web Service, please change
    'MailServerImap4 to MailServerEWS to MailServer.Protocol

    'To receive email with Exchange WebDAV, please change
    'MailServerImap4 to MailServerDAV to MailServer.Protocol

    'Exchange Server supports POP3/IMAP4 protocol as well, but in Exchange 2007
    'or later version, POP3/IMAP4 service is disabled by default. If you don't want to use POP3/IMAP4
    'to download email from Exchange Server, you can use Exchange Web Service(Exchange 2007/2010 or
    'later version) or WebDAV(Exchange 2000/2003) protocol.

    Dim oServer As New EAGetMailObjLib.MailServer
    oServer.Server = sServer
    oServer.User = sUserName
    oServer.Password = sPassword
    oServer.SSLConnection = bSSLConnection
    oServer.Protocol = MailServerImap4
    
    ''by default, the pop3 port is 110, imap4 port is 143,
    'the pop3 ssl port is 995, imap4 ssl port is 993
    'you can also change the port like this
    'oServer.Port = 110
    If oServer.Protocol = MailServerImap4 Then
        If oServer.SSLConnection Then
            oServer.Port = 993 'SSL IMAP4
        Else
            oServer.Port = 143 'IMAP4 normal
        End If
    Else
        If oServer.SSLConnection Then
            oServer.Port = 995 'SSL POP3
        Else
            oServer.Port = 110 'POP3 normal
        End If
    End If
    
    On Error GoTo ErrorHandle
        oClient.Connect oServer

        ' get emails that have:
        ' read flag and received datetime is from now to 2013-10-1
        ' and sender contains "support" and subject contains "test"
        
        Dim options
        options = GetMailInfos_ReadOnly
        options = options Or GetMailInfos_DateRange
        options = options Or GetMailInfos_OrderByDateTime

        oClient.GetMailInfosParam.Reset
        oClient.GetMailInfosParam.GetMailInfosOptions = options

        'oClient.GetMailInfosParam.SubjectContains = "eFax"
   '    " * or % or ?"
' like "*" &  "@efax.com.bh"
       oClient.GetMailInfosParam.SenderContains = "?@efax.com.bh"
        
        oClient.GetMailInfosParam.DateRangeSINCE = "2014-12-1"
        oClient.GetMailInfosParam.DateRangeBEFORE = "2014-12-31"
        'More Examples:

        'Get only new email:
        'Dim options
        'options = GetMailInfos_NewOnly
        'oClient.GetMailInfosParam.GetMailInfosOptions = options
        
        'Get only new email that subject contains "test":
        'Dim options
        'options = GetMailInfos_NewOnly
        'oClient.GetMailInfosParam.GetMailInfosOptions = options
        'oClient.GetMailInfosParam.SubjectContains = "test"

        'Get emails by IMAP4 sequence range:
        'Dim options
        'options= GetMailInfos_SeqRange
        'oClient.GetMailInfosParam.GetMailInfosOptions = options
        'oClient.GetMailInfosParam.SeqRange = "1:10"
        

        Dim infos
        infos = oClient.GetMailInfos()
        
        Dim i, Count
        Count = UBound(infos)
        For i = LBound(infos) To Count
            Dim info As EAGetMailObjLib.MailInfo
            Set info = infos(i)
            
      '      MsgBox "UIDL: " & info.UIDL
   '         MsgBox "Index: " & info.Index
    '        MsgBox "Size: " & info.Size
            'For POP3/Exchange Web Service/WebDAV, the IMAP4MailFlags is meaningless.
   '         MsgBox "Flags: " & info.IMAP4Flags
            'For POP3, the Read is meaningless.
   '         MsgBox "Read: " & info.Read
   '         MsgBox "Deleted: " & info.Deleted

            Dim oMail As EAGetMailObjLib.Mail
            Set oMail = oClient.GetMail(info)
            'Save mail to local
            oMail.SaveAs "C:\Users\TAREQ\Desktop\inbox\" & i & ".eml", True
        Next

        For i = LBound(infos) To Count
            oClient.Delete (infos(i))
        Next

        '' Delete method just mark the email as deleted,
        ' Quit method pure the emails from server exactly.
        oClient.Quit
        MsgBox "finsh"
        Exit Sub
ErrorHandle:
        ''Error handle
        MsgBox Err.Description
        
        oClient.Close
End Sub

Private Sub Command0_Click()

Call ReceiveMail("pop.gmail.com", "tst1@gmail.com", "123456", True)

'Call ReceiveMail("imap.gmail.com", "tst1@gmail.com", "123456", True)


End Sub
ivan  
#4 Posted : Friday, January 2, 2015 1:13:54 AM(UTC)
ivan

Rank: Administration

Groups: Administrators
Joined: 11/11/2010(UTC)
Posts: 1,013

Thanks: 9 times
Was thanked: 41 time(s) in 41 post(s)
Hi, IMAP4 search doesn't support * or ? wildcard.

You should use:

oClient.GetMailInfosParam.SenderContains = "@efax.com.bh"

and you must use imap.gmail.com as server address.

and please use the following code to select mail folder at first.
Code:

Function SearchFolder(ByRef folders, _
    ByVal name As String) As Imap4Folder
       
    Dim i As Integer
       
    For i = LBound(folders) To UBound(folders)
        Dim folder As EAGetMailObjLib.Imap4Folder
        Set folder = folders(i)
        MsgBox folder.FullPath

        ' Folder was found.
        If StrComp(folder.name, name, vbTextCompare) = 0 Then
            Set SearchFolder = folder
            Exit Function
        End If

        Set folder = SearchFolder(folder.SubFolders, name)
        If Not (folder Is Nothing) Then
             Set SearchFolder = folder
             Exit Function
        End If
    Next

    ' No folder found
    Set SearchFolder = Nothing
End Function


   ' Lookup folder based on name.
    Dim folder As Imap4Folder
'this is a special folder in Gmail, it contains all emails in your account.
    Set folder = SearchFolder(oClient.Imap4Folders, "[Gmail]\All Mail") 
    If folder Is Nothing Then
        Err.Raise 2, "ImapFolder", "Folder was not found"
    End If

    ' Select this folder
    oClient.SelectFolder folder 'select this folder

 Dim infos
infos = oClient.GetMailInfos()
        

Edited by user Friday, January 2, 2015 1:16:52 AM(UTC)  | Reason: Not specified

tariq  
#5 Posted : Friday, January 2, 2015 4:52:22 AM(UTC)
tariq

Rank: Newbie

Groups: Registered
Joined: 1/1/2015(UTC)
Posts: 7
Bahrain
Location: riffa

IVAN Thank you very much for this Help
Actually this is what I want
but I find it difficult to merge the codes
I'm trying merge the codes to run But To now I can not

Please Can you merge the codes Above
With all the thanks and appreciation
ivan  
#6 Posted : Friday, January 2, 2015 6:41:38 PM(UTC)
ivan

Rank: Administration

Groups: Administrators
Joined: 11/11/2010(UTC)
Posts: 1,013

Thanks: 9 times
Was thanked: 41 time(s) in 41 post(s)
Code:

Function SearchFolder(ByRef folders, _
ByVal name As String) As Imap4Folder

Dim i As Integer

For i = LBound(folders) To UBound(folders)
Dim folder As EAGetMailObjLib.Imap4Folder
Set folder = folders(i)
MsgBox folder.FullPath

' Folder was found.
If StrComp(folder.name, name, vbTextCompare) = 0 Then
Set SearchFolder = folder
Exit Function
End If

Set folder = SearchFolder(folder.SubFolders, name)
If Not (folder Is Nothing) Then
Set SearchFolder = folder
Exit Function
End If
Next

' No folder found
Set SearchFolder = Nothing
End Function

Public Sub ReceiveMail( _
ByVal sServer As String, _
ByVal sUserName As String, _
ByVal sPassword As String, _
ByVal bSSLConnection As Boolean)
     
    Const MailServerPop3 = 0
    Const MailServerImap4 = 1
    Const MailServerEWS = 2
    Const MailServerDAV = 3
 
    Const GetMailInfos_All = 1
    Const GetMailInfos_NewOnly = 2
    Const GetMailInfos_ReadOnly = 4
    Const GetMailInfos_SeqRange = 8
    Const GetMailInfos_UIDRange = 16
    Const GetMailInfos_PR_ENTRYID = 32
    Const GetMailInfos_DateRange = 64
    Const GetMailInfos_OrderByDateTime = 128
 
    'For evaluation usage, please use "TryIt" as the license code, otherwise the
    '"invalid license code" exception will be thrown. However, the object will expire in 1-2 months, then
    '"trial version expired" exception will be thrown.
    Dim oClient As New EAGetMailObjLib.MailClient
    oClient.LicenseCode = "TryIt"
     
    'To receive email with Exchange Web Service, please change
    'MailServerImap4 to MailServerEWS to MailServer.Protocol
 
    'To receive email with Exchange WebDAV, please change
    'MailServerImap4 to MailServerDAV to MailServer.Protocol
 
    'Exchange Server supports POP3/IMAP4 protocol as well, but in Exchange 2007
    'or later version, POP3/IMAP4 service is disabled by default. If you don't want to use POP3/IMAP4
    'to download email from Exchange Server, you can use Exchange Web Service(Exchange 2007/2010 or
    'later version) or WebDAV(Exchange 2000/2003) protocol.
 
    Dim oServer As New EAGetMailObjLib.MailServer
    oServer.Server = sServer
    oServer.User = sUserName
    oServer.Password = sPassword
    oServer.SSLConnection = bSSLConnection
    oServer.Protocol = MailServerImap4
     
    ''by default, the pop3 port is 110, imap4 port is 143,
    'the pop3 ssl port is 995, imap4 ssl port is 993
    'you can also change the port like this
    'oServer.Port = 110
    If oServer.Protocol = MailServerImap4 Then
        If oServer.SSLConnection Then
            oServer.Port = 993 'SSL IMAP4
        Else
            oServer.Port = 143 'IMAP4 normal
        End If
    Else
        If oServer.SSLConnection Then
            oServer.Port = 995 'SSL POP3
        Else
            oServer.Port = 110 'POP3 normal
        End If
    End If
     
    On Error GoTo ErrorHandle
        oClient.Connect oServer
 
   ' Lookup folder based on name.
   Dim folder As Imap4Folder
  'this is a special folder in Gmail, it contains all emails in your account.
   Set folder = SearchFolder(oClient.Imap4Folders, "[Gmail]\All Mail") 
   If folder Is Nothing Then
    Err.Raise 2, "ImapFolder", "Folder was not found"
   End If

   ' Select this folder
    oClient.SelectFolder folder 'select this folder


        ' get emails that have:
        ' read flag and received datetime is from now to 2013-10-1
        ' and sender contains "support" and subject contains "test"
         
        Dim options
        options = GetMailInfos_ReadOnly
        options = options Or GetMailInfos_DateRange
        options = options Or GetMailInfos_OrderByDateTime
 
        oClient.GetMailInfosParam.Reset
        oClient.GetMailInfosParam.GetMailInfosOptions = options
 
        'oClient.GetMailInfosParam.SubjectContains = "eFax"
   '    " * or % or ?"
' like "*" &  "@efax.com.bh"
       oClient.GetMailInfosParam.SenderContains = "@efax.com.bh"
         
        oClient.GetMailInfosParam.DateRangeSINCE = "2014-12-1"
        oClient.GetMailInfosParam.DateRangeBEFORE = "2014-12-31"
        'More Examples:
 
        'Get only new email:
        'Dim options
        'options = GetMailInfos_NewOnly
        'oClient.GetMailInfosParam.GetMailInfosOptions = options
         
        'Get only new email that subject contains "test":
        'Dim options
        'options = GetMailInfos_NewOnly
        'oClient.GetMailInfosParam.GetMailInfosOptions = options
        'oClient.GetMailInfosParam.SubjectContains = "test"
 
        'Get emails by IMAP4 sequence range:
        'Dim options
        'options= GetMailInfos_SeqRange
        'oClient.GetMailInfosParam.GetMailInfosOptions = options
        'oClient.GetMailInfosParam.SeqRange = "1:10"
         
 
        Dim infos
        infos = oClient.GetMailInfos()
         
        Dim i, Count
        Count = UBound(infos)
        For i = LBound(infos) To Count
            Dim info As EAGetMailObjLib.MailInfo
            Set info = infos(i)
             
      '      MsgBox "UIDL: " & info.UIDL
   '         MsgBox "Index: " & info.Index
    '        MsgBox "Size: " & info.Size
            'For POP3/Exchange Web Service/WebDAV, the IMAP4MailFlags is meaningless.
   '         MsgBox "Flags: " & info.IMAP4Flags
            'For POP3, the Read is meaningless.
   '         MsgBox "Read: " & info.Read
   '         MsgBox "Deleted: " & info.Deleted
 
            Dim oMail As EAGetMailObjLib.Mail
            Set oMail = oClient.GetMail(info)
            'Save mail to local
            oMail.SaveAs "C:\Users\TAREQ\Desktop\inbox\" & i & ".eml", True
        Next
 
        For i = LBound(infos) To Count
            oClient.Delete (infos(i))
        Next
 
        '' Delete method just mark the email as deleted,
        ' Quit method pure the emails from server exactly.
        oClient.Quit
        MsgBox "finsh"
        Exit Sub
ErrorHandle:
        ''Error handle
        MsgBox Err.Description
         
        oClient.Close
End Sub
 
Private Sub Command0_Click()
 
 
 Call ReceiveMail("imap.gmail.com", "tst1@gmail.com", "123456", True)
 
 
End Sub
tariq  
#7 Posted : Friday, January 2, 2015 9:56:46 PM(UTC)
tariq

Rank: Newbie

Groups: Registered
Joined: 1/1/2015(UTC)
Posts: 7
Bahrain
Location: riffa

Thank you very much IVAN
I really appreciate help
Unfortunately the code is not working as it should
I'll try to run it
Thank you very much
ivan  
#8 Posted : Saturday, January 3, 2015 1:51:10 AM(UTC)
ivan

Rank: Administration

Groups: Administrators
Joined: 11/11/2010(UTC)
Posts: 1,013

Thanks: 9 times
Was thanked: 41 time(s) in 41 post(s)
what error did you get?

could you generate a log file with LogFileName property and send the log file to our support email address?

oClient.LogFileName = "d:\imap.txt" ' add this line before Connect.
oClient.Connect ...

Edited by user Saturday, January 3, 2015 1:53:14 AM(UTC)  | Reason: Not specified

tariq  
#9 Posted : Saturday, January 3, 2015 3:56:08 AM(UTC)
tariq

Rank: Newbie

Groups: Registered
Joined: 1/1/2015(UTC)
Posts: 7
Bahrain
Location: riffa


Sat, 3 Jan 2015 14:47:38 +0300
Server: imap.gmail.com
Port: 993
AuthType: AuthLogin
User: tariqaleed2@gmail.com
Password: *****
SSLConnection: True
SSLType: ConnectSSLAuto
Protocol: Imap4
SocksProxyServer:
SocksProxyPort: 1080
SocksProxyUser:
SocksProxyPassword:
ProxyProtocol: Socks5

Connecting imap.gmail.com 993
Connected
_CreateCredentials for SSL connection
_ClientHandshake for SSL connection
_ClientHandshakeLoop for SSL connection
SSL Recv: ss: 0; IoBuffer: 117; buf[0]: 7, 21; buf[1]: 1, 68; buf[2]: 6, 28; buf[3]: 0, 0;
* OK Gimap ready for requests from 109.63.126.105 ts9mb51848617wjc
[seq] LOGIN [user] *****
SSL Recv: ss: 0; IoBuffer: 261; buf[0]: 7, 21; buf[1]: 1, 205; buf[2]: 6, 35; buf[3]: 0, 14352884;
* CAPABILITY IMAP4rev1 UNSELECT IDLE NAMESPACE QUOTA ID XLIST CHILDREN X-GM-EXT-1 UIDPLUS COMPRESS=DEFLATE ENABLE MOVE CONDSTORE ESEARCH UTF8=ACCEPT
A0001 OK tariqaleed2@gmail.com authenticated (Success)
A0002 LIST "" ""
SSL Recv: ss: 0; IoBuffer: 101; buf[0]: 7, 21; buf[1]: 1, 46; buf[2]: 6, 34; buf[3]: 0, 1672;
* LIST (\Noselect) "/" "/"
A0002 OK Success
A0003 LIST "" "*"
SSL Recv: ss: 0; IoBuffer: 949; buf[0]: 7, 21; buf[1]: 1, 900; buf[2]: 6, 28; buf[3]: 0, 0;
* LIST (\HasNoChildren) "/" "INBOX"
* LIST (\HasNoChildren) "/" "Junk E-mail"
* LIST (\HasChildren \Noselect) "/" "[Gmail]"
* LIST (\Flagged \HasNoChildren) "/" "[Gmail]/&BicGRAYxBjMGJwYmBkQ- &BicGRAZFBkUGSgYyBik- &BigGRgYsBkUGKQ-"
* LIST (\Junk \HasNoChildren) "/" "[Gmail]/&BicGRAYxBjMGJwYmBkQ- &BjoGSgYx- &BicGRAZFBjEGOgZIBig- &BkEGSgZHBic-"
* LIST (\HasNoChildren \Trash) "/" "[Gmail]/&BicGRAZFBkcGQAZFBkQGJwYq-"
* LIST (\Sent \HasNoChildren) "/" "[Gmail]/&BigGMQZKBi8- &BkUGMQYzBkQ-"
* LIST (\All \HasNoChildren) "/" "[Gmail]/&BkMGRA- &BicGRAYoBjEGSgYv-"
* LIST (\HasNoChildren \Drafts) "/" "[Gmail]/&BkUGMwZIBi8GJwYq-"
* LIST (\HasNoChildren \Important) "/" "[Gmail]/&BkUGRwZF-"
* LIST (\HasNoChildren) "/" "&BicGRAYlBkoGNQYnBkQGJwYq-"
* LIST (\HasNoChildren) "/" "&BjMGQQYx-"
* LIST (\HasNoChildren) "/" "&BjQGLgY1Bko-"
* LIST (\HasNoChildren) "/" "&BjkGRQZE-"
A0003 OK Success
A0004 LSUB "" "*"
SSL Recv: ss: 0; IoBuffer: 949; buf[0]: 7, 21; buf[1]: 1, 900; buf[2]: 6, 28; buf[3]: 0, 17;
* LSUB (\HasNoChildren) "/" "INBOX"
* LSUB (\HasNoChildren) "/" "Junk E-mail"
* LSUB (\HasChildren \Noselect) "/" "[Gmail]"
* LSUB (\Flagged \HasNoChildren) "/" "[Gmail]/&BicGRAYxBjMGJwYmBkQ- &BicGRAZFBkUGSgYyBik- &BigGRgYsBkUGKQ-"
* LSUB (\Junk \HasNoChildren) "/" "[Gmail]/&BicGRAYxBjMGJwYmBkQ- &BjoGSgYx- &BicGRAZFBjEGOgZIBig- &BkEGSgZHBic-"
* LSUB (\HasNoChildren \Trash) "/" "[Gmail]/&BicGRAZFBkcGQAZFBkQGJwYq-"
* LSUB (\Sent \HasNoChildren) "/" "[Gmail]/&BigGMQZKBi8- &BkUGMQYzBkQ-"
* LSUB (\All \HasNoChildren) "/" "[Gmail]/&BkMGRA- &BicGRAYoBjEGSgYv-"
* LSUB (\HasNoChildren \Drafts) "/" "[Gmail]/&BkUGMwZIBi8GJwYq-"
* LSUB (\HasNoChildren \Important) "/" "[Gmail]/&BkUGRwZF-"
* LSUB (\HasNoChildren) "/" "&BicGRAYlBkoGNQYnBkQGJwYq-"
* LSUB (\HasNoChildren) "/" "&BjMGQQYx-"
* LSUB (\HasNoChildren) "/" "&BjQGLgY1Bko-"
* LSUB (\HasNoChildren) "/" "&BjkGRQZE-"
A0004 OK Success
tariq  
#10 Posted : Saturday, January 3, 2015 4:07:16 AM(UTC)
tariq

Rank: Newbie

Groups: Registered
Joined: 1/1/2015(UTC)
Posts: 7
Bahrain
Location: riffa

Quote:
' Lookup folder based on name.
Dim folder As Imap4Folder
'this is a special folder in Gmail, it contains all emails in your account.
Set folder = SearchFolder(oClient.Imap4Folders, "[Gmail]\All Mail")
If folder Is Nothing Then
Err.Raise 2, "ImapFolder", "Folder was not found"
End If
Quote:
the CODE connect to here then connects the SearchFolder Function Does not connect until the last Current Function

' Select this folder
oClient.SelectFolder folder 'select this folder
ivan  
#11 Posted : Saturday, January 3, 2015 4:47:41 AM(UTC)
ivan

Rank: Administration

Groups: Administrators
Joined: 11/11/2010(UTC)
Posts: 1,013

Thanks: 9 times
Was thanked: 41 time(s) in 41 post(s)

please use imap4_full.vb6 to connect your IMAP4 server, then you will get all folders name.

There MUST be a folder named [GMAIL]\all mail, [all mail] is in your language (not English), then change your code

Set folder = SearchFolder(oClient.Imap4Folders, "[Gmail]\All Mail")

change "[Gmail]\All Mail" to your folder name.
tariq  
#12 Posted : Saturday, January 3, 2015 12:25:27 PM(UTC)
tariq

Rank: Newbie

Groups: Registered
Joined: 1/1/2015(UTC)
Posts: 7
Bahrain
Location: riffa

Thank you very much for your help
I really appreciate you this work
Greetings
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2019, Yet Another Forum.NET
This page was generated in 0.133 seconds.

EXPLORE TUTORIALS

© All Rights Reserved, AdminSystem Software Limited.