PB.Ex Mail (Windows)

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
User avatar
RSBasic
Moderator
Moderator
Posts: 1218
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

PB.Ex Mail (Windows)

Post by RSBasic »

Hello

With this library you can develop your own e-mail client and download e-mails via IMAP and POP3. SSL and TLS are supported.

Functions:
  • OpenMailEx()
    • Syntax:

      Code: Select all

      Result = OpenMailEx(ID, Protocol, MailServer$, Port, UserName$, Password$, SSL, ProtocolVersion, @ErrorOutput$)
    • Description: Establishes a connection to the mail server.
    • Parameter:
      1. ID: A unique number. #PB_Any can be used to generate the number automatically.
      2. Protocol: One of the following protocols can be used:
        • #PBEx_Mail_Protocol_IMAP
        • #PBEx_Mail_Protocol_POP3: Note: Please use this protocol for testing purposes only. This protocol is obsolete and will not be further developed.
        • #PBEx_Mail_Protocol_SMTP: Only valid for SendMailEx() and SendMailFileEx().
      3. MailServer$: The address to the mail server
      4. Port: Port number
      5. UserName$: Username or email address for login.
      6. Password$: Password for login.
      7. SSL: If 1, then an encrypted connection is established.
      8. ProtocolVersion: Specifies the protocol version for the encrypted connection. The following constants can be used:
        • #PBEx_Mail_ProtocolVersion_SSL30: SSL 3.0
        • #PBEx_Mail_ProtocolVersion_TLS10: TLS 1.0
        • #PBEx_Mail_ProtocolVersion_TLS11: TLS 1.1
        • #PBEx_Mail_ProtocolVersion_TLS12: TLS 1.2
        • #PBEx_Mail_ProtocolVersion_TLS13: TLS 1.3
      9. @ErrorOutput$: If an error occurred, the error message is stored in the variable. This variable must be reserved with 128 characters before passing. Maximum length of the return is 128 characters including the NULL character. If no error description is to be returned for an error, 0 can be passed instead.
    • Return value:
      • 1: The process was successful. If #PB_Any is used, the ID is returned.
    • Example:

      Code: Select all

      EnableExplicit
      
      Global PBEx_Mail
      
      #PBEx_Mail_Version$ = "1.1.6.0"
      #PBEx_Mail_Protocol_IMAP = 0
      #PBEx_Mail_Protocol_POP3 = 1
      #PBEx_Mail_Protocol_SMTP = 2
      #PBEx_Mail_ProtocolVersion_SSL30 = 0
      #PBEx_Mail_ProtocolVersion_TLS10 = 1
      #PBEx_Mail_ProtocolVersion_TLS11 = 2
      #PBEx_Mail_ProtocolVersion_TLS12 = 3
      #PBEx_Mail_ProtocolVersion_TLS13 = 4
      #PBEx_Mail_Priority_Normal = 0
      #PBEx_Mail_Priority_Low = 1
      #PBEx_Mail_Priority_High = 2
      #PBEx_Mail_Event_NewMail = 0
      #PBEx_Mail_Attribute_Unseen = 0
      #PBEx_Mail_Attribute_Seen = 32
      #PBEx_Mail_SeenType_AllMails = 0
      #PBEx_Mail_SeenType_OnlySeenMails = 1
      #PBEx_Mail_SeenType_OnlyUnseenMails = 2
      #PBEx_Mail_FetchType_AllData = 0
      #PBEx_Mail_FetchType_OnlyHeaderData = 1
      
      CompilerIf #PB_Compiler_Processor = #PB_Processor_x86
        PBEx_Mail = OpenLibrary(#PB_Any, "PB.Ex_Mail_x86.dll")
      CompilerElseIf #PB_Compiler_Processor = #PB_Processor_x64
        PBEx_Mail = OpenLibrary(#PB_Any, "PB.Ex_Mail_x64.dll")
      CompilerEndIf
      
      If PBEx_Mail
        Prototype OpenMailEx(ID, Protocol, MailServer.p-Unicode, Port, UserName.p-Unicode, Password.p-Unicode, SSL, ProtocolVersion, ErrorOutput)
        Global OpenMailEx.OpenMailEx = GetFunction(PBEx_Mail, "OpenMailEx")
        Prototype CloseMailEx(ID, ErrorOutput)
        Global CloseMailEx.CloseMailEx = GetFunction(PBEx_Mail, "CloseMailEx")
        Prototype ExamineMailDirectoryEx(ID, ErrorOutput)
        Global ExamineMailDirectoryEx.ExamineMailDirectoryEx = GetFunction(PBEx_Mail, "ExamineMailDirectoryEx")
        Prototype MailDirectoryEntryNameEx(ID, Output, ErrorOutput)
        Global MailDirectoryEntryNameEx.MailDirectoryEntryNameEx = GetFunction(PBEx_Mail, "MailDirectoryEntryNameEx")
        Prototype ExamineMailEx(ID, SeenType, FetchType, SortByNew, ErrorOutput)
        Global ExamineMailEx.ExamineMailEx = GetFunction(PBEx_Mail, "ExamineMailEx")
        Prototype MailEntrySubjectEx(ID, Output, ErrorOutput)
        Global MailEntrySubjectEx.MailEntrySubjectEx = GetFunction(PBEx_Mail, "MailEntrySubjectEx")
        Prototype MailEntryBodyEx(ID, Output, ErrorOutput)
        Global MailEntryBodyEx.MailEntryBodyEx = GetFunction(PBEx_Mail, "MailEntryBodyEx")
        Prototype MailEntryFromEx(ID, Output, ErrorOutput)
        Global MailEntryFromEx.MailEntryFromEx = GetFunction(PBEx_Mail, "MailEntryFromEx")
        Prototype MailEntryToEx(ID, Output, ErrorOutput)
        Global MailEntryToEx.MailEntryToEx = GetFunction(PBEx_Mail, "MailEntryToEx")
        Prototype MailEntryCCEx(ID, Output, ErrorOutput)
        Global MailEntryCCEx.MailEntryCCEx = GetFunction(PBEx_Mail, "MailEntryCCEx")
        Prototype MailEntryBCCEx(ID, Output, ErrorOutput)
        Global MailEntryBCCEx.MailEntryBCCEx = GetFunction(PBEx_Mail, "MailEntryBCCEx")
        Prototype MailEntryDateEx(ID, ErrorOutput)
        Global MailEntryDateEx.MailEntryDateEx = GetFunction(PBEx_Mail, "MailEntryDateEx")
        Prototype MailEntryPriorityEx(ID, ErrorOutput)
        Global MailEntryPriorityEx.MailEntryPriorityEx = GetFunction(PBEx_Mail, "MailEntryPriorityEx")
        Prototype FinishMailDirectoryEx(ID, ErrorOutput)
        Global FinishMailDirectoryEx.FinishMailDirectoryEx = GetFunction(PBEx_Mail, "FinishMailDirectoryEx")
        Prototype FinishMailEx(ID, ErrorOutput)
        Global FinishMailEx.FinishMailEx = GetFunction(PBEx_Mail, "FinishMailEx")
        Prototype IsMailEx(ID, ErrorOutput)
        Global IsMailEx.IsMailEx = GetFunction(PBEx_Mail, "IsMailEx")
        Prototype NextMailDirectoryEntryEx(ID, ErrorOutput)
        Global NextMailDirectoryEntryEx.NextMailDirectoryEntryEx = GetFunction(PBEx_Mail, "NextMailDirectoryEntryEx")
        Prototype NextMailEntryEx(ID, ErrorOutput)
        Global NextMailEntryEx.NextMailEntryEx = GetFunction(PBEx_Mail, "NextMailEntryEx")
        Prototype SetMailDirectoryEx(ID, DirectoryPath.p-Unicode, ErrorOutput)
        Global SetMailDirectoryEx.SetMailDirectoryEx = GetFunction(PBEx_Mail, "SetMailDirectoryEx")
        Prototype CreateMailDirectoryEx(ID, DirectoryName.p-Unicode, ErrorOutput)
        Global CreateMailDirectoryEx.CreateMailDirectoryEx = GetFunction(PBEx_Mail, "CreateMailDirectoryEx")
        Prototype RenameMailDirectoryEx(ID, OldDirectoryName.p-Unicode, NewDirectoryName.p-Unicode, ErrorOutput)
        Global RenameMailDirectoryEx.RenameMailDirectoryEx = GetFunction(PBEx_Mail, "RenameMailDirectoryEx")
        Prototype DeleteMailDirectoryEx(ID, DirectoryPath.p-Unicode, ErrorOutput)
        Global DeleteMailDirectoryEx.DeleteMailDirectoryEx = GetFunction(PBEx_Mail, "DeleteMailDirectoryEx")
        Prototype CreateMailEx(ID, Directory.p-Unicode, Subject.p-Unicode, Body.p-Unicode, Priority, From.p-Unicode, ToAddress.p-Unicode, CC.p-Unicode, BCC.p-Unicode, Attachments.p-Unicode, ErrorOutput)
        Global CreateMailEx.CreateMailEx = GetFunction(PBEx_Mail, "CreateMailEx")
        Prototype BindMailEventEx(ID, Event, PBProcedureHandle, PID, ErrorOutput)
        Global BindMailEventEx.BindMailEventEx = GetFunction(PBEx_Mail, "BindMailEventEx")
        Prototype GetMailSubjectEx(ID, MailID, DirectoryPath.p-Unicode, Output, ErrorOutput)
        Global GetMailSubjectEx.GetMailSubjectEx = GetFunction(PBEx_Mail, "GetMailSubjectEx")
        Prototype GetMailBodyEx(ID, MailID, DirectoryPath.p-Unicode, Output, ErrorOutput)
        Global GetMailBodyEx.GetMailBodyEx = GetFunction(PBEx_Mail, "GetMailBodyEx")
        Prototype GetMailFromEx(ID, MailID, DirectoryPath.p-Unicode, Output, ErrorOutput)
        Global GetMailFromEx.GetMailFromEx = GetFunction(PBEx_Mail, "GetMailFromEx")
        Prototype GetMailToEx(ID, MailID, DirectoryPath.p-Unicode, Output, ErrorOutput)
        Global GetMailToEx.GetMailToEx = GetFunction(PBEx_Mail, "GetMailToEx")
        Prototype GetMailCCEx(ID, MailID, DirectoryPath.p-Unicode, Output, ErrorOutput)
        Global GetMailCCEx.GetMailCCEx = GetFunction(PBEx_Mail, "GetMailCCEx")
        Prototype GetMailBCCEx(ID, MailID, DirectoryPath.p-Unicode, Output, ErrorOutput)
        Global GetMailBCCEx.GetMailBCCEx = GetFunction(PBEx_Mail, "GetMailBCCEx")
        Prototype GetMailDateEx(ID, MailID, DirectoryPath.p-Unicode, ErrorOutput)
        Global GetMailDateEx.GetMailDateEx = GetFunction(PBEx_Mail, "GetMailDateEx")
        Prototype GetMailPriorityEx(ID, MailID, DirectoryPath.p-Unicode, ErrorOutput)
        Global GetMailPriorityEx.GetMailPriorityEx = GetFunction(PBEx_Mail, "GetMailPriorityEx")
        Prototype MailEntryBodySizeEx(ID, ErrorOutput)
        Global MailEntryBodySizeEx.MailEntryBodySizeEx = GetFunction(PBEx_Mail, "MailEntryBodySizeEx")
        Prototype MailIDEx(ID, ErrorOutput)
        Global MailIDEx.MailIDEx = GetFunction(PBEx_Mail, "MailIDEx")
        Prototype SetMailSubjectEx(ID, MailID, Directory.p-Unicode, Text.p-Unicode, ErrorOutput)
        Global SetMailSubjectEx.SetMailSubjectEx = GetFunction(PBEx_Mail, "SetMailSubjectEx")
        Prototype SetMailBodyEx(ID, MailID, Directory.p-Unicode, Text.p-Unicode, ErrorOutput)
        Global SetMailBodyEx.SetMailBodyEx = GetFunction(PBEx_Mail, "SetMailBodyEx")
        Prototype SetMailFromEx(ID, MailID, Directory.p-Unicode, Text.p-Unicode, ErrorOutput)
        Global SetMailFromEx.SetMailFromEx = GetFunction(PBEx_Mail, "SetMailFromEx")
        Prototype SetMailToEx(ID, MailID, Directory.p-Unicode, Text.p-Unicode, ErrorOutput)
        Global SetMailToEx.SetMailToEx = GetFunction(PBEx_Mail, "SetMailToEx")
        Prototype SetMailCCEx(ID, MailID, Directory.p-Unicode, Text.p-Unicode, ErrorOutput)
        Global SetMailCCEx.SetMailCCEx = GetFunction(PBEx_Mail, "SetMailCCEx")
        Prototype SetMailBCCEx(ID, MailID, Directory.p-Unicode, Text.p-Unicode, ErrorOutput)
        Global SetMailBCCEx.SetMailBCCEx = GetFunction(PBEx_Mail, "SetMailBCCEx")
        Prototype SetMailPriorityEx(ID, MailID, Directory.p-Unicode, Priority, ErrorOutput)
        Global SetMailPriorityEx.SetMailPriorityEx = GetFunction(PBEx_Mail, "SetMailPriorityEx")
        Prototype DeleteMailEx(ID, MailID, Directory.p-Unicode, ErrorOutput)
        Global DeleteMailEx.DeleteMailEx = GetFunction(PBEx_Mail, "DeleteMailEx")
        Prototype MoveMailEx(ID, MailID, Directory.p-Unicode, TargetDirectory.p-Unicode, ErrorOutput)
        Global MoveMailEx.MoveMailEx = GetFunction(PBEx_Mail, "MoveMailEx")
        Prototype CountMailEx(ID, Directory.p-Unicode, ErrorOutput)
        Global CountMailEx.CountMailEx = GetFunction(PBEx_Mail, "CountMailEx")
        Prototype CountMailDirectoryEx(ID, ErrorOutput)
        Global CountMailDirectoryEx.CountMailDirectoryEx = GetFunction(PBEx_Mail, "CountMailDirectoryEx")
        Prototype SendMailEx(ID, Subject.p-Unicode, Body.p-Unicode, Priority, From.p-Unicode, ToAddress.p-Unicode, CC.p-Unicode, BCC.p-Unicode, Attachments.p-Unicode, ErrorOutput)
        Global SendMailEx.SendMailEx = GetFunction(PBEx_Mail, "SendMailEx")
        Prototype SaveMailEx(ID, MailID, Directory.p-Unicode, Path.p-Unicode, ErrorOutput)
        Global SaveMailEx.SaveMailEx = GetFunction(PBEx_Mail, "SaveMailEx")
        Prototype GetMailHeaderEx(ID, MailID, Directory.p-Unicode, Output, ErrorOutput)
        Global GetMailHeaderEx.GetMailHeaderEx = GetFunction(PBEx_Mail, "GetMailHeaderEx")
        Prototype MailEntryHeaderEx(ID, Output, ErrorOutput)
        Global MailEntryHeaderEx.MailEntryHeaderEx = GetFunction(PBEx_Mail, "MailEntryHeaderEx")
        Prototype LoadMailEx(ID, Path.p-Unicode, Directory.p-Unicode, ErrorOutput)
        Global LoadMailEx.LoadMailEx = GetFunction(PBEx_Mail, "LoadMailEx")
        Prototype SendMailFileEx(ID, Path.p-Unicode, ErrorOutput)
        Global SendMailFileEx.SendMailFileEx = GetFunction(PBEx_Mail, "SendMailFileEx")
        Prototype CountMailAttachmentsEx(ID, ErrorOutput)
        Global CountMailAttachmentsEx.CountMailAttachmentsEx = GetFunction(PBEx_Mail, "CountMailAttachmentsEx")
        Prototype ExamineMailAttachmentsEx(ID, ErrorOutput)
        Global ExamineMailAttachmentsEx.ExamineMailAttachmentsEx = GetFunction(PBEx_Mail, "ExamineMailAttachmentsEx")
        Prototype NextMailEntryAttachmentsEx(ID, ErrorOutput)
        Global NextMailEntryAttachmentsEx.NextMailEntryAttachmentsEx = GetFunction(PBEx_Mail, "NextMailEntryAttachmentsEx")
        Prototype MailEntryAttachmentsFileNameEx(ID, Output, ErrorOutput)
        Global MailEntryAttachmentsFileNameEx.MailEntryAttachmentsFileNameEx = GetFunction(PBEx_Mail, "MailEntryAttachmentsFileNameEx")
        Prototype SaveMailEntryAttachmentsEx(ID, Path.p-Unicode, ErrorOutput)
        Global SaveMailEntryAttachmentsEx.SaveMailEntryAttachmentsEx = GetFunction(PBEx_Mail, "SaveMailEntryAttachmentsEx")
        Prototype FinishMailAttachmentsEx(ID, ErrorOutput)
        Global FinishMailAttachmentsEx.FinishMailAttachmentsEx = GetFunction(PBEx_Mail, "FinishMailAttachmentsEx")
        Prototype GetMailAttachmentsEx(ID, MailID, Directory.p-Unicode, ErrorOutput)
        Global GetMailAttachmentsEx.GetMailAttachmentsEx = GetFunction(PBEx_Mail, "GetMailAttachmentsEx")
        Prototype SetMailAttachmentsEx(ID, MailID, Directory.p-Unicode, Attachments.p-Unicode, ErrorOutput)
        Global SetMailAttachmentsEx.SetMailAttachmentsEx = GetFunction(PBEx_Mail, "SetMailAttachmentsEx")
        Prototype MailEntryAttributeEx(ID, ErrorOutput)
        Global MailEntryAttributeEx.MailEntryAttributeEx = GetFunction(PBEx_Mail, "MailEntryAttributeEx")
        Prototype SetMailAttributeEx(ID, MailID, Directory.p-Unicode, Attributes, ErrorOutput)
        Global SetMailAttributeEx.SetMailAttributeEx = GetFunction(PBEx_Mail, "SetMailAttributeEx")
        Prototype GetMailAttributeEx(ID, MailID, Directory.p-Unicode, ErrorOutput)
        Global GetMailAttributeEx.GetMailAttributeEx = GetFunction(PBEx_Mail, "GetMailAttributeEx")
        
      EndIf
      
      Global Output$ = Space(1000000)
      Global ErrorOutput$ = Space(128)
      
      Procedure NewMail(MailID$)
        Protected MailID = Val(MailID$)
        
        GetMailSubjectEx(1, MailID, "", @Output$, @ErrorOutput$)
        Debug "Subject: " + Output$
        GetMailFromEx(1, MailID, "", @Output$, @ErrorOutput$)
        Debug "From: " + Output$
        GetMailToEx(1, MailID, "", @Output$, @ErrorOutput$)
        Debug "To: " + Output$
        Debug "Date: " + FormatDate("%dd.%mm.%yyyy %hh:%ii:%ss", GetMailDateEx(1, MailID, "", @ErrorOutput$))
        
      EndProcedure
      
      If OpenMailEx(1, #PBEx_Mail_Protocol_IMAP, "imap.gmail.com", 993, "yourmailaddress@gmail.com", "YourPassword", 1, #PBEx_Mail_ProtocolVersion_TLS13, @ErrorOutput$)
        
      ;  ;Notify automatically when new emails arrive.
      ;   If OpenWindow(0, 0, 0, 500, 400, "Window", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
      ;     
      ;     BindMailEventEx(1, #PBEx_Mail_Event_NewMail, @NewMail(), GetCurrentProcessId_(), @ErrorOutput$)
      ;     
      ;     Repeat
      ;       Select WaitWindowEvent()
      ;         Case #PB_Event_CloseWindow
      ;           End
      ;       EndSelect
      ;     ForEver
      ;   EndIf
        
      ;   ;Determine all directories (only for IMAP)
      ;   If ExamineMailDirectoryEx(1, @ErrorOutput$)
      ;     While NextMailDirectoryEntryEx(1, @ErrorOutput$)
      ;       MailDirectoryEntryNameEx(1, @Output$, @ErrorOutput$)
      ;       Debug Output$
      ;     Wend
      ;   
      ;   EndIf
        
        ;Determine all mail from inbox
        ;Or from any directory
        ;SetMailDirectoryEx(1, "Downloadportale/Chip", @ErrorOutput$)
        If ExamineMailEx(1, #PBEx_Mail_SeenType_AllMails, #PBEx_Mail_FetchType_AllData, 0, @ErrorOutput$)
          While NextMailEntryEx(1, @ErrorOutput$)
            MailEntrySubjectEx(1, @Output$, @ErrorOutput$)
            Debug "Subject: " + Output$
            MailEntryFromEx(1, @Output$, @ErrorOutput$)
            Debug "From: " + Output$
            MailEntryToEx(1, @Output$, @ErrorOutput$)
            Debug "To: " + Output$
            Debug "Date: " + FormatDate("%dd.%mm.%yyyy %hh:%ii:%ss", MailEntryDateEx(1, @ErrorOutput$))
             Debug MailIDEx(1, @ErrorOutput$)
            Debug Str(CountMailAttachmentsEx(1, @ErrorOutput$)) + " attachment(s)"
            
            If ExamineMailAttachmentsEx(1, @ErrorOutput$)
              While NextMailEntryAttachmentsEx(1, @ErrorOutput$)
                If MailEntryAttachmentsFileNameEx(1, @Output$, @ErrorOutput$)
                  Debug Output$
                EndIf
              Wend
            EndIf
            
            Debug "--------------------------------------------------"
          Wend
         
        EndIf
       
        CloseMailEx(1, @ErrorOutput$)
      Else
        Debug ErrorOutput$
      EndIf
      
      CloseLibrary(PBEx_Mail)
      
      
  • CloseMailEx()
    • Syntax:

      Code: Select all

      Result = CloseMailEx(ID, @ErrorOutput$)
    • Description: Closes the connection to the mail server.
    • Parameter:
      1. ID: The number of the connection.
      2. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
  • ExamineMailDirectoryEx()
    • Syntax:

      Code: Select all

      Result = ExamineMailDirectoryEx(ID, @ErrorOutput$)
    • Description: Starts the listing from the directory structure. POP3 does not support directories.
    • Parameter:
      1. ID: The number of the connection.
      2. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
  • MailDirectoryEntryNameEx()
    • Syntax:

      Code: Select all

      Result = MailDirectoryEntryNameEx(ID, @Output, @ErrorOutput$)
    • Description: The name of the directory is determined. This function is only valid within the ExamineMailDirectoryEx loop. This function is not supported with POP3.
    • Parameter:
      1. ID: The number of the connection.
      2. @Output: The name of the directory is stored in this variable.
      3. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
  • ExamineMailEx()
    • Syntax:

      Code: Select all

      Result = ExamineMailEx(ID, SeenType, FetchType, SortByNew, @ErrorOutput$)
    • Description: Starts the collection from the current directory.
    • Parameter:
      1. ID: The number of the connection.
      2. SeenType: Determines whether all e-mails or only e-mails that have already been read or have not yet been read are determined. This function is not supported with POP3. The following constants can be used:
        • #PBEx_Mail_SeenType_AllMails
        • #PBEx_Mail_SeenType_OnlySeenMails
        • #PBEx_Mail_SeenType_OnlyUnseenMails
      3. FetchType: Determines whether all data or only the header data of the e-mails is downloaded. This function is not supported with POP3. The following constants can be used:
        • #PBEx_Mail_FetchType_AllData
        • #PBEx_Mail_FetchType_OnlyHeaderData
      4. SortByNew: Defines the order in which e-mails are determined:
        • 0: The emails that were created first are determined first.
        • 1: The newest e-mails are determined first.
      5. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
  • MailEntrySubjectEx()
    • Syntax:

      Code: Select all

      Result = MailEntrySubjectEx(ID, @Output, @ErrorOutput$)
    • Description: Determines the subject of the e-mail. This function is only valid within the ExamineMailEx loop.
    • Parameter:
      1. ID: The number of the connection.
      2. @Output: Subject of the email is stored in this variable.
      3. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
  • MailEntryBodyEx()
    • Syntax:

      Code: Select all

      Result = MailEntryBodyEx(ID, @Output, @ErrorOutput$)
    • Description: Determines the content of the e-mail. It can be either plain text or HTML. This function is only valid within the ExamineMailEx loop.
    • Parameter:
      1. ID: The number of the connection.
      2. @Output: The content of the e-mail is stored in this variable.
      3. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
  • MailEntryFromEx()
    • Syntax:

      Code: Select all

      Result = MailEntryFromEx(ID, @Output, @ErrorOutput$)
    • Description: Determines the sender of the e-mail. This function is only valid within the ExamineMailEx loop.
    • Parameter:
      1. ID: The number of the connection.
      2. @Output: The sender of the e-mail is stored in this variable.
      3. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
  • MailEntryToEx()
    • Syntax:

      Code: Select all

      Result = MailEntryToEx(ID, @Output, @ErrorOutput$)
    • Description: Determines the recipient of the e-mail. This function is only valid within the ExamineMailEx loop.
    • Parameter:
      1. ID: The number of the connection.
      2. @Output: The recipient of the e-mail is stored in this variable.
      3. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
  • MailEntryCCEx()
    • Syntax:

      Code: Select all

      Result = MailEntryCCEx(ID, @Output, @ErrorOutput$)
    • Description: Determines the CC recipient (visible recipient) of the e-mail. This function is only valid within the ExamineMailEx loop.
    • Parameter:
      1. ID: The number of the connection.
      2. @Output: CC recipient of the e-mail is stored in this variable.
      3. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
  • MailEntryBCCEx()
    • Syntax:

      Code: Select all

      Result = MailEntryBCCEx(ID, @Output, @ErrorOutput$)
    • Description: Determines the BCC recipient (invisible recipient) of the e-mail. This function is only valid within the ExamineMailEx loop.
    • Parameter:
      1. ID: The number of the connection.
      2. @Output: BCC recipient of the e-mail is stored in this variable.
      3. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
  • MailEntryDateEx()
    • Syntax:

      Code: Select all

      Result = MailEntryDateEx(ID, @ErrorOutput$)
    • Description: Determines the date of the e-mail. This function is only valid within the ExamineMailEx loop.
    • Parameter:
      1. ID: The number of the connection.
      2. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value: The date of the e-mail. The value can be used with the date library.
  • MailEntryPriorityEx()
    • Syntax:

      Code: Select all

      Result = MailEntryPriorityEx(ID, @ErrorOutput$)
    • Description: Determines the specified priority of the e-mail. This function is only valid within the ExamineMailEx loop.
    • Parameter:
      1. ID: The number of the connection.
      2. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value: The priority of the e-mail. The following constants can be queried:
      • #PBEx_Mail_Priority_Normal
      • #PBEx_Mail_Priority_Low
      • #PBEx_Mail_Priority_High
  • FinishMailDirectoryEx()
    • Syntax:

      Code: Select all

      Result = FinishMailDirectoryEx(ID, @ErrorOutput$)
    • Description: Closes the listing of the directory structure.
    • Parameter:
      1. ID: The number of the connection.
      2. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
  • FinishMailEx()
    • Syntax:

      Code: Select all

      Result = FinishMailEx(ID, @ErrorOutput$)
    • Description: Closes the list of the current directory.
    • Parameter:
      1. ID: The number of the connection.
      2. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
  • IsMailEx()
    • Syntax:

      Code: Select all

      Result = IsMailEx(ID, @ErrorOutput$)
    • Description: Checks if the connection is still valid.
    • Parameter:
      1. ID: The number of the connection.
      2. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: ID ist gültig.
  • NextMailDirectoryEntryEx()
    • Syntax:

      Code: Select all

      Result = NextMailDirectoryEntryEx(ID, @ErrorOutput$)
    • Description: The next directory is determined. This function is not supported with POP3.
    • Parameter:
      1. ID: The number of the connection.
      2. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
  • NextMailEntryEx()
    • Syntax:

      Code: Select all

      Result = NextMailEntryEx(ID, @ErrorOutput$)
    • Description: The next e-mail will be determined.
    • Parameter:
      1. ID: The number of the connection.
      2. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
  • SetMailDirectoryEx()
    • Syntax:

      Code: Select all

      Result = SetMailDirectoryEx(ID, DirectoryPath$, @ErrorOutput$)
    • Description: Opens the directory to find the emails in this directory. This function is not supported with POP3.
    • Parameter:
      1. ID: The number of the connection.
      2. DirectoryPath$: Name or full path of the directory. If empty, the inbox directory is selected.
      3. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
  • CreateMailDirectoryEx()
    • Syntax:

      Code: Select all

      Result = CreateMailDirectoryEx(ID, DirectoryName$, @ErrorOutput$)
    • Description: Creates a new directory. This function is not supported with POP3.
    • Parameter:
      1. ID: The number of the connection.
      2. DirectoryName$: Name of the directory.
      3. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
  • RenameMailDirectoryEx()
    • Syntax:

      Code: Select all

      Result = RenameMailDirectoryEx(ID, OldDirectoryName$, NewDirectoryName$, @ErrorOutput$)
    • Description: Renames an existing directory. This function is not supported with POP3.
    • Parameter:
      1. ID: The number of the connection.
      2. OldDirectoryName$: Name of the directory.
      3. NewDirectoryName$: New name for the directory.
      4. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
  • DeleteMailDirectoryEx()
    • Syntax:

      Code: Select all

      Result = DeleteMailDirectoryEx(ID, DirectoryName$, @ErrorOutput$)
    • Description: Removes an existing directory. This function is not supported with POP3.
    • Parameter:
      1. ID: The number of the connection.
      2. DirectoryName$: Name of the directory.
      3. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
  • CreateMailEx()
    • Syntax:

      Code: Select all

      Result = CreateMailEx(ID, Directory$, Subject$, Body$, Priority, From$, ToAddress$, CC$, BCC$, Attachments$, @ErrorOutput$)
    • Description: Creates a new email that is not sent.
    • Parameter:
      1. ID: The number of the connection.
      2. Directory$: Name of the directory
      3. Subject$: E-mail subject
      4. Body$: Contents of the e-mail
      5. Priority: Determination of the priority. One of the following constants can be used:
        • #PBEx_Mail_Priority_Normal
        • #PBEx_Mail_Priority_Low
        • #PBEx_Mail_Priority_High
      6. From$: E-mail address of the sender.
      7. ToAddress$: E-mail address of the recipient. Multiple email addresses can be separated with semicolons.
      8. CC$: E-mail address of the recipient (visible recipient). Multiple email addresses can be separated with semicolons.
      9. BCC$: E-mail address of the recipient (invisible recipient). Multiple email addresses can be separated with semicolons.
      10. Attachments$: Full path to the file to be added as an attachment. Multiple attachments can be separated with the | character.
      11. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
  • BindMailEventEx()
    • Syntax:

      Code: Select all

      Result = BindMailEventEx(ID, Event, @PBProcedure(), PID, @ErrorOutput$)
    • Description: Link a procedure to an event.
    • Parameter:
      1. ID: The number of the connection.
      2. Event: Specifies the event to be queried. One of the following constants can be used:
        • #PBEx_Mail_Event_NewMail: The event is triggered as soon as new e-mails are available.
      3. @PBProcedure(): The handle number of the procedure that is automatically called when the specified event is triggered.
      4. PID: The PID number of your own program.
      5. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
  • GetMailSubjectEx()
    • Syntax:

      Code: Select all

      Result = GetMailSubjectEx(ID, MailID, DirectoryPath$, @Output$, @ErrorOutput$)
    • Description: Determines the subject using the MailID.
    • Parameter:
      1. ID: The number of the connection.
      2. MailID: The number of a single e-mail.
      3. DirectoryPath$: The name or full path to the directory where the specified email is located. If empty, the inbox directory is selected.
      4. @Output$: The subject is stored in this variable.
      5. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
  • GetMailBodyEx()
    • Syntax:

      Code: Select all

      Result = GetMailBodyEx(ID, MailID, DirectoryPath$, @Output$, @ErrorOutput$)
    • Description: Determines the content using the MailID.
    • Parameter:
      1. ID: The number of the connection.
      2. MailID: The number of a single e-mail.
      3. DirectoryPath$: The name or full path to the directory where the specified email is located. If empty, the inbox directory is selected.
      4. @Output$: The content is stored in this variable.
      5. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
  • GetMailFromEx()
    • Syntax:

      Code: Select all

      Result = GetMailFromEx(ID, MailID, DirectoryPath$, @Output$, @ErrorOutput$)
    • Description: Determines the sender using the MailID.
    • Parameter:
      1. ID: The number of the connection.
      2. MailID: The number of a single e-mail.
      3. DirectoryPath$: The name or full path to the directory where the specified email is located. If empty, the inbox directory is selected.
      4. @Output$: The sender is stored in this variable.
      5. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
  • GetMailToEx()
    • Syntax:

      Code: Select all

      Result = GetMailToEx(ID, MailID, DirectoryPath$, @Output$, @ErrorOutput$)
    • Description: Determines the recipient using the MailID.
    • Parameter:
      1. ID: The number of the connection.
      2. MailID: The number of a single e-mail.
      3. DirectoryPath$: The name or full path to the directory where the specified email is located. If empty, the inbox directory is selected.
      4. @Output$: The receiver is stored in this variable.
      5. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
  • GetMailCCEx()
    • Syntax:

      Code: Select all

      Result = GetMailCCEx(ID, MailID, DirectoryPath$, @Output$, @ErrorOutput$)
    • Description: Determines the CC recipient using the MailID. (visible recipient)
    • Parameter:
      1. ID: The number of the connection.
      2. MailID: The number of a single e-mail.
      3. DirectoryPath$: The name or full path to the directory where the specified email is located. If empty, the inbox directory is selected.
      4. @Output$: The CC receiver is stored in this variable.
      5. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
  • GetMailBCCEx()
    • Syntax:

      Code: Select all

      Result = GetMailBCCEx(ID, MailID, DirectoryPath$, @Output$, @ErrorOutput$)
    • Description: Determines the BCC recipient using the MailID. (invisible recipient)
    • Parameter:
      1. ID: The number of the connection.
      2. MailID: The number of a single e-mail.
      3. DirectoryPath$: The name or full path to the directory where the specified email is located. If empty, the inbox directory is selected.
      4. @Output$: The BCC receiver is stored in this variable.
      5. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
  • GetMailDateEx()
    • Syntax:

      Code: Select all

      Result = GetMailDateEx(ID, MailID, DirectoryPath$, @ErrorOutput$)
    • Description: Determines the date using the MailID.
    • Parameter:
      1. ID: The number of the connection.
      2. MailID: The number of a single e-mail.
      3. DirectoryPath$: The name or full path to the directory where the specified email is located. If empty, the inbox directory is selected.
      4. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value: The date of the e-mail. The value can be used with the date library.
  • GetMailPriorityEx()
    • Syntax:

      Code: Select all

      Result = GetMailPriorityEx(ID, MailID, DirectoryPath$, @ErrorOutput$)
    • Description: Determines the priority using the MailID.
    • Parameter:
      1. ID: The number of the connection.
      2. MailID: The number of a single e-mail.
      3. DirectoryPath$: The name or full path to the directory where the specified email is located. If empty, the inbox directory is selected.
      4. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value: The priority of the e-mail. The following constants can be queried:
      • #PBEx_Mail_Priority_Normal
      • #PBEx_Mail_Priority_Low
      • #PBEx_Mail_Priority_High
  • MailEntryBodySizeEx()
    • Syntax:

      Code: Select all

      Result = MailEntryBodySizeEx(ID, @ErrorOutput$)
    • Description: Determines the size in bytes for allocating memory.
    • Parameter:
      1. ID: The number of the connection.
      2. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value: Size in bytes
  • MailIDEx()
    • Syntax:

      Code: Select all

      Result = MailIDEx(ID, @ErrorOutput$)
    • Description: Determines the mail ID for reading or changing properties. This function is only valid within the ExamineMailEx loop.
    • Parameter:
      1. ID: The number of the connection.
      2. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value: ID of the e-mail
  • SetMailSubjectEx()
    • Syntax:

      Code: Select all

      Result = SetMailSubjectEx(ID, MailID, Directory$, Text$, @ErrorOutput$)
    • Description: Changes the subject using the mail ID. Due to the specification that the e-mail must not be modified subsequently, the changed e-mail is saved as a new e-mail. This function is not supported with POP3.
    • Parameter:
      1. ID: The number of the connection.
      2. MailID: ID of the e-mail
      3. Directory$: Name of the directory
      4. Text$: Changes with the specified value.
      5. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
  • SetMailBodyEx()
    • Syntax:

      Code: Select all

      Result = SetMailBodyEx(ID, MailID, Directory$, Text$, @ErrorOutput$)
    • Description: Changes the content using the mail ID. Due to the specification that the e-mail must not be modified subsequently, the changed e-mail is saved as a new e-mail. This function is not supported with POP3.
    • Parameter:
      1. ID: The number of the connection.
      2. MailID: ID of the e-mail
      3. Directory$: Name of the directory
      4. Text$: Changes with the specified value.
      5. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
  • SetMailFromEx()
    • Syntax:

      Code: Select all

      Result = SetMailFromEx(ID, MailID, Directory$, Text$, @ErrorOutput$)
    • Description: Changes the sender using the mail ID. Due to the specification that the e-mail must not be modified subsequently, the changed e-mail is saved as a new e-mail. This function is not supported with POP3.
    • Parameter:
      1. ID: The number of the connection.
      2. MailID: ID of the e-mail
      3. Directory$: Name of the directory
      4. Text$: Changes with the specified value.
      5. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
  • SetMailToEx()
    • Syntax:

      Code: Select all

      Result = SetMailToEx(ID, MailID, Directory$, Text$, @ErrorOutput$)
    • Description: Changes the recipient using the mail ID. Due to the specification that the e-mail must not be modified subsequently, the changed e-mail is saved as a new e-mail. This function is not supported with POP3.
    • Parameter:
      1. ID: The number of the connection.
      2. MailID: ID of the e-mail
      3. Directory$: Name of the directory
      4. Text$: Changes with the specified value. Multiple email addresses can be separated with semicolons.
      5. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
  • SetMailCCEx()
    • Syntax:

      Code: Select all

      Result = SetMailCCEx(ID, MailID, Directory$, Text$, @ErrorOutput$)
    • Description: Changes the CC recipient (visible recipient) using the mail ID. Due to the specification that the e-mail must not be modified subsequently, the changed e-mail is saved as a new e-mail. This function is not supported with POP3.
    • Parameter:
      1. ID: The number of the connection.
      2. MailID: ID of the e-mail
      3. Directory$: Name of the directory
      4. Text$: Changes with the specified value. Multiple email addresses can be separated with semicolons.
      5. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
  • SetMailBCCEx()
    • Syntax:

      Code: Select all

      Result = SetMailBCCEx(ID, MailID, Directory$, Text$, @ErrorOutput$)
    • Description: Changes the BCC recipient (invisible recipient) using the mail ID. Due to the specification that the e-mail must not be modified subsequently, the changed e-mail is saved as a new e-mail. This function is not supported with POP3.
    • Parameter:
      1. ID: The number of the connection.
      2. MailID: ID of the e-mail
      3. Directory$: Name of the directory
      4. Text$: Changes with the specified value. Multiple email addresses can be separated with semicolons.
      5. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
  • SetMailPriorityEx()
    • Syntax:

      Code: Select all

      Result = SetMailPriorityEx(ID, MailID, Directory$, Priority, @ErrorOutput$)
    • Description: Changes the priority using the mail ID. Due to the specification that the e-mail must not be modified subsequently, the changed e-mail is saved as a new e-mail. This function is not supported with POP3.
    • Parameter:
      1. ID: The number of the connection.
      2. MailID: ID of the e-mail
      3. Directory$: Name of the directory
      4. Priority: Priority of the e-mail. One of the following constants can be used:
        • #PBEx_Mail_Priority_Normal
        • #PBEx_Mail_Priority_Low
        • #PBEx_Mail_Priority_High
      5. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
  • DeleteMailEx()
    • Syntax:

      Code: Select all

      Result = DeleteMailEx(ID, MailID, Directory$, @ErrorOutput$)
    • Description: Removes the e-mail using the mail ID and directory. This function is not supported with POP3.
    • Parameter:
      1. ID: The number of the connection.
      2. MailID: ID of the e-mail
      3. Directory$: Name or full path to the directory where the specified e-mail is located. If empty, the inbox directory is selected.
      4. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
  • MoveMailEx()
    • Syntax:

      Code: Select all

      Result = MoveMailEx(ID, MailID, Directory$, TargetDirectory$, @ErrorOutput$)
    • Description: Moves the e-mail to the specified target directory using the mail ID and the source directory. This function is not supported with POP3.
    • Parameter:
      1. ID: The number of the connection.
      2. MailID: ID of the e-mail
      3. Directory$: Name or full path to the directory where the specified e-mail is located. If empty, the inbox directory is selected.
      4. TargetDirectory$: Name or full path to the directory to which the e-mail is to be moved. If empty, the inbox directory is selected.
      5. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
  • CountMailEx()
    • Syntax:

      Code: Select all

      Result = CountMailEx(ID, Directory$, @ErrorOutput$)
    • Description: Determines how many e-mails exist in the specified directory.
    • Parameter:
      1. ID: The number of the connection.
      2. Directory$: Name or full path to the directory. If empty, the inbox directory is selected.
      3. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value: Number of e-mails.
  • CountMailDirectoryEx()
    • Syntax:

      Code: Select all

      Result = CountMailDirectoryEx(ID, @ErrorOutput$)
    • Description: Determines how many directories exist. This function is not supported with POP3.
    • Parameter:
      1. ID: The number of the connection.
      2. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value: Number of directories.
  • SendMailEx()
    • Syntax:

      Code: Select all

      Result = SendMailEx(ID, Subject$, Body$, Priority, From$, ToAddress$, CC$, BCC$, Attachments$, @ErrorOutput$)
    • Description: Sends a new e-mail.
    • Parameter:
      1. ID: The number of the connection.
      2. Subject$: E-mail subject
      3. Body$: Contents of the e-mail
      4. Priority: Determination of the priority. One of the following constants can be used:
        • #PBEx_Mail_Priority_Normal
        • #PBEx_Mail_Priority_Low
        • #PBEx_Mail_Priority_High
      5. From$: E-mail address of the sender.
      6. ToAddress$: E-mail address of the recipient. Multiple email addresses can be separated with semicolons.
      7. CC$: E-mail address of the recipient (visible recipient). Multiple email addresses can be separated with semicolons.
      8. BCC$: E-mail address of the recipient (invisible recipient). Multiple email addresses can be separated with semicolons.
      9. Attachments$: Full path to the file to be added as an attachment. Multiple attachments can be separated with the | character. Aliases are supported. Example: OriginalFile.zip<AliasFile.zip>
      10. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
  • SaveMailEx()
    • Syntax:

      Code: Select all

      Result = SaveMailEx(ID, MailID, Directory$, Path$, @ErrorOutput$)
    • Description: Saves an existing e-mail as an EML file on the hard disk.
    • Parameter:
      1. ID: The number of the connection.
      2. MailID: The number of a single e-mail.
      3. DirectoryPath$: The name or full path to the directory where the specified email is located. If empty, the inbox directory is selected.
      4. Path$: Complete path incl. file name where the e-mail should be exported to.
      5. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
  • GetMailHeaderEx()
    • Syntax:

      Code: Select all

      Result = GetMailHeaderEx(ID, MailID, Directory$, @Output$, @ErrorOutput$)
    • Description: Determines the complete header of the e-mail using the MailID.
    • Parameter:
      1. ID: The number of the connection.
      2. MailID: The number of a single e-mail.
      3. DirectoryPath$: The name or full path to the directory where the specified email is located. If empty, the inbox directory is selected.
      4. @Output$: The header is stored in this variable.
      5. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
  • MailEntryHeaderEx()
    • Syntax:

      Code: Select all

      Result = MailEntryHeaderEx(ID, @Output, @ErrorOutput$)
    • Description: Determines the header of the e-mail. This function is only valid within the ExamineMailEx loop.
    • Parameter:
      1. ID: The number of the connection.
      2. @Output$: The header is stored in this variable.
      3. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
  • LoadMailEx()
    • Syntax:

      Code: Select all

      Result = LoadMailEx(ID, Path$, Directory$, @ErrorOutput$)
    • Description: Imports an EML file into the specified directory. This function is not supported with POP3.
    • Parameter:
      1. ID: The number of the connection.
      2. Path$: Full path to the EML file.
      3. Directory$: Name or full path to the directory. If empty, the inbox directory is selected.
      4. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value: MailID of the imported e-mail.
  • SendMailFileEx()
    • Syntax:

      Code: Select all

      Result = SendMailFileEx(ID, Path$, @ErrorOutput$)
    • Description: Sends an e-mail using an EML file.
    • Parameter:
      1. ID: The number of the connection.
      2. Path$: Full path to the EML file.
      3. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
  • CountMailAttachmentsEx()
    • Syntax:

      Code: Select all

      Result = CountMailAttachmentsEx(ID, @ErrorOutput$)
    • Description: Determines how many attachments exist in the current e-mail. This function is only valid within the ExamineMailEx loop.
    • Parameter:
      1. ID: The number of the connection.
      2. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value: Number of attachments
  • ExamineMailAttachmentsEx()
    • Syntax:

      Code: Select all

      Result = ExamineMailAttachmentsEx(ID, @ErrorOutput$)
    • Description: Starts the list of attachments from the current e-mail. This function is only valid within the ExamineMailEx loop or if GetMailAttachmentsEx() was previously called.
    • Parameter:
      1. ID: The number of the connection.
      2. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
  • NextMailEntryAttachmentsEx()
    • Syntax:

      Code: Select all

      Result = NextMailEntryAttachmentsEx(ID, @ErrorOutput$)
    • Description: The next attachment of the current e-mail is determined.
    • Parameter:
      1. ID: The number of the connection.
      2. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
  • MailEntryAttachmentsFileNameEx()
    • Syntax:

      Code: Select all

      Result = MailEntryAttachmentsFileNameEx(ID, @Output, @ErrorOutput$)
    • Description: Determines the file name of the attachment from the current e-mail. This function is only valid within the ExamineMailAttachmentsEx loop or if GetMailAttachmentsEx() was previously called.
    • Parameter:
      1. ID: The number of the connection.
      2. @Output: File name of the attachment is stored in this variable.
      3. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
  • SaveMailEntryAttachmentsEx()
    • Syntax:

      Code: Select all

      Result = SaveMailEntryAttachmentsEx(ID, Path$, @ErrorOutput$)
    • Description: Saves the attachment as a file on the hard disk. This function is only valid within the ExamineMailAttachmentsEx loop or if GetMailAttachmentsEx() was called before.
    • Parameter:
      1. ID: The number of the connection.
      2. Path$: Complete path including file name to which the attachment should be exported.
      3. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
  • FinishMailAttachmentsEx()
    • Syntax:

      Code: Select all

      Result = FinishMailAttachmentsEx(ID, @ErrorOutput$)
    • Description: Closes the list of attachments from the current email. This function is only valid within the ExamineMailEx loop or if GetMailAttachmentsEx() was previously called.
    • Parameter:
      1. ID: The number of the connection.
      2. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
  • GetMailAttachmentsEx()
    • Syntax:

      Code: Select all

      Result = GetMailAttachmentsEx(ID, MailID, DirectoryPath$, @ErrorOutput$)
    • Description: Defines the e-mail for the list of attachments. This function can be called before the ExamineMailAttachmentsEx loop so that the ExamineMailAttachmentsEx() function does not find all e-mails but the specified e-mail.
    • Parameter:
      1. ID: The number of the connection.
      2. MailID: Die Nummer der E-Mail.
      3. DirectoryPath$: The name or full path to the directory where the specified email is located. If empty, the inbox directory is selected.
      4. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
  • SetMailAttachmentsEx()
    • Syntax:

      Code: Select all

      Result = SetMailAttachmentsEx(ID, MailID, DirectoryPath$, Attachments$, @ErrorOutput$)
    • Description: Adds files as attachments.
    • Parameter:
      1. ID: The number of the connection.
      2. MailID: The number of the e-mail.
      3. DirectoryPath$: The name or full path to the directory where the specified email is located. If empty, the inbox directory is selected.
      4. Attachments$: Full path to the file to be added as an attachment. Multiple attachments can be separated with the | character.
      5. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
  • MailEntryAttributeEx()
    • Syntax:

      Code: Select all

      Result = MailEntryAttributeEx(ID, @ErrorOutput$)
    • Description: Determines the status of the e-mail. This function is only valid within the ExamineMailEx loop. This function is not supported with POP3.
    • Parameter:
      1. ID: The number of the connection.
      2. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value: The following constants can be queried:
      • #PBEx_Mail_Attribute_Unseen: E-mail has not yet been read.
      • #PBEx_Mail_Attribute_Seen: E-mail has already been read.
  • GetMailAttributeEx()
    • Syntax:

      Code: Select all

      Result = GetMailAttributeEx(ID, MailID, DirectoryPath$, @ErrorOutput$)
    • Description: Determines the status of the e-mail using the MailID. This function is not supported with POP3.
    • Parameter:
      1. ID: The number of the connection.
      2. MailID: The number of the e-mail.
      3. DirectoryPath$: The name or full path to the directory where the specified email is located. If empty, the inbox directory is selected.
      4. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value: The following constants can be queried:
      • #PBEx_Mail_Attribute_Unseen: E-mail has not yet been read.
      • #PBEx_Mail_Attribute_Seen: E-mail has already been read.
  • SetMailAttributeEx()
    • Syntax:

      Code: Select all

      Result = SetMailAttributeEx(ID, MailID, DirectoryPath$, Attributes, @ErrorOutput$)
    • Description: Changes the status of the e-mail using the MailID. This function is not supported with POP3.
    • Parameter:
      1. ID: The number of the connection.
      2. MailID: The number of the e-mail.
      3. DirectoryPath$: The name or full path to the directory where the specified email is located. If empty, the inbox directory is selected.
      4. Attributes: The following constants can be used:
        • #PBEx_Mail_Attribute_Unseen: E-mail has not yet been read.
        • #PBEx_Mail_Attribute_Seen: E-mail has already been read.
      5. @ErrorOutput$: If an error occurs, the error message is stored in the string variable.
    • Return value:
      • 1: The process was successful.
Hint: With Google Mail it can happen that your own client is blocked for security reasons. To explicitly allow: Google Account > Security > Access by Less Secure Apps
Depending on the number of e-mails in a directory and the speed Internet, it may take some time.

System requirements:
  • Windows Vista or higher
  • .NET Framework 4.8 or higher
  • Unicode activation (default from PB 5.50)
Licence: This DLL file is free of charge and may be used both privately and commercially.
The following copyright texts must be provided:
Copyright (c) 2012-2014 Torben Könke
MimeKit is Copyright (C) 2012-2018 Xamarin Inc.
Copyright © 2019 RSBasic.de
Download: https://www.rsbasic.de/downloads/downlo ... x_Mail.zip
Image

I would be very pleased about feedbacks, improvement suggestions, error messages or wishes. If you want to support me, you can also donate something. Thanks :)
Image
Image
User avatar
RSBasic
Moderator
Moderator
Posts: 1218
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: PB.Ex Mail (Windows)

Post by RSBasic »

PB.Ex Mail 1.0.1.0 has been released.

Changelog:
  • Added: CreateMailDirectoryEx()
  • Added: RenameMailDirectoryEx()
  • Added: DeleteMailDirectoryEx()
  • Added: CreateMalEx()
  • Added: BindMailEventEx(): #PBEx_Mail_Event_NewMail: This automatically calls a PB procedure as soon as new e-mails are available.
  • Added: GetMailSubjectEx()
  • Added: GetMailBodyEx()
  • Added: GetMailFromEx()
  • Added: GetMailToEx()
  • Added: GetMailCCEx()
  • Added: GetMailBCCEx()
  • Added: GetMailDateEx()
  • Added: GetMailPriorityEx()
  • Added: MailEntryBodySizeEx(): The size in bytes of body can be determined beforehand for allocating the memory.
  • Changed: MailEntryPriorityEx(): The name of the priority is no longer returned, but the value of one of the following constants: #PBEx_Mail_Priority_Normal, #PBEx_Mail_Priority_Low, #PBEx_Mail_Priority_High
Image
Image
User avatar
RSBasic
Moderator
Moderator
Posts: 1218
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: PB.Ex Mail (Windows)

Post by RSBasic »

PB.Ex Mail 1.0.2.0 has been released.

Changelog:
  • Added: MailIDEx()
  • Added: SetMailSubjectEx()
  • Added: SetMailBodyEx()
  • Added: SetMailFromEx()
  • Added: SetMailToEx()
  • Added: SetMailCCEx()
  • Added: SetMailBCCEx()
  • Added: SetMailPriorityEx()
  • Added: DeleteMailEx()
  • Added: MoveMailEx()
  • Added: CountMailEx()
  • Added: CountMailDirectoryEx()
  • Changed: CreateMailEx(): The MailID of the new e-mail is now returned.
  • Changed: GetMailSubjectEx()
  • Changed: GetMailBodyEx()
  • Changed: GetMailFromEx()
  • Changed: GetMailToEx()
  • Changed: GetMailCCEx()
  • Changed: GetMailBCCEx()
  • Changed: MessageID is now called MailID
  • Changed: Help descriptions for the individual functions
Image
Image
User avatar
RSBasic
Moderator
Moderator
Posts: 1218
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: PB.Ex Mail (Windows)

Post by RSBasic »

PB.Ex Mail 1.0.3.0 has been released.

Changelog:
  • Added: SendMailEx()
  • Added: SaveMailEx()
  • Added: GetMailHeaderEx()
  • Added: MailEntryHeaderEx()
  • Optimized: ExamineMailEx(): Better performance
  • Changed: CreateMailEx(): Directory parameter has been added.
  • Changed: SetMailSubjectEx(): Directory parameter has been added.
  • Changed: SetMailBodyEx(): Directory parameter has been added.
  • Changed: SetMailFromEx(): Directory parameter has been added.
  • Changed: SetMailToEx(): Directory parameter has been added.
  • Changed: SetMailCCEx(): Directory parameter has been added.
  • Changed: SetMailBCCEx(): Directory parameter has been added.
  • Changed: SetMailPriorityEx(): Directory parameter has been added.
Image
Image
BarryG
Addict
Addict
Posts: 3292
Joined: Thu Apr 18, 2019 8:17 am

Re: PB.Ex Mail (Windows)

Post by BarryG »

Thank you for this code, I definitely have a use for it in the near future.

Do you know if the version of .NET that it requires is pre-installed on at least Windows 7 and up? I'm thinking I may have to drop XP support for my program. My program is advertised as portable and won't have a Setup file, so being able for the user to just unzip and run my program with no further downloads is vital.
User avatar
RSBasic
Moderator
Moderator
Posts: 1218
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: PB.Ex Mail (Windows)

Post by RSBasic »

Here you can see which .NET version is pre-installed and installable: https://docs.microsoft.com/de-de/dotnet ... pendencies
Many applications from the Internet are based on .NET and it has been standard for years and preinstalled on current operating systems.
Each of my systems has 4.0 and 4.5 installed.
You can also find out which .NET versions are installed: https://docs.microsoft.com/en-us/dotnet ... -installed
Image
Image
User avatar
RSBasic
Moderator
Moderator
Posts: 1218
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: PB.Ex Mail (Windows)

Post by RSBasic »

PB.Ex Mail 1.0.4.0 has been released.

Changelog:
  • Added: LoadMailEx()
  • Added: SendMailFileEx()
Image
Image
User avatar
RSBasic
Moderator
Moderator
Posts: 1218
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: PB.Ex Mail (Windows)

Post by RSBasic »

PB.Ex Mail 1.0.5.0 has been released.

Changelog:
  • Added: CountMailAttachmentsEx()
  • Added: ExamineMailAttachmentsEx()
  • Added: NextMailEntryAttachmentsEx()
  • Added: MailEntryAttachmentsFileNameEx()
  • Added: SaveMailEntryAttachmentsEx()
  • Added: FinishMailAttachmentsEx()
  • Added: GetMailAttachmentsEx()
  • Added: SetMailAttachmentsEx()
  • Changed: SendMailEx(): Attachments can now be added.
  • Changed: CreateMailEx(): Attachments can now be added.
  • Changed: SendMailFileEx(): Attachments are now taken into account.
  • Changed: LoadMailEx(): Attachments are now taken into account.
  • Changed: OutputError$ must be reserved with 128 characters before passing. Maximum length of the return is 128 characters including the NULL character.
  • Changed: OutputError$: This parameter is now optional and can be 0.
  • Optimized: POP3
  • Bugfixes
Image
Image
User avatar
RSBasic
Moderator
Moderator
Posts: 1218
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: PB.Ex Mail (Windows)

Post by RSBasic »

PB.Ex Mail 1.0.6.0 has been released.

Changelog:
  • Added: MailEntryAttributeEx(): This can be used to determine whether the e-mail was read.
  • Added: SetMailAttributeEx(): This allows you to mark an e-mail as read or unread.
  • Added: GetMailAttributeEx(): This can be used to determine whether the e-mail was read.
Image
Image
User avatar
RSBasic
Moderator
Moderator
Posts: 1218
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: PB.Ex Mail (Windows)

Post by RSBasic »

PB.Ex Mail 1.0.7.0 has been released.

Changelog:
  • Bugfix: NextMailEntryEx(): If the date field was NULL, it failed.
Image
Image
User avatar
RSBasic
Moderator
Moderator
Posts: 1218
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: PB.Ex Mail (Windows)

Post by RSBasic »

PB.Ex Mail 1.0.8.0 has been released.

Changelog:
  • Changed: ExamineMailEx(): Added new parameter to set the order of determination. If SortByNew = 0, then the first e-mail is determined first. If SortByNew = 1, then the newest e-mail is determined first.
  • Changed: ExamineMailEx(): Added new parameter to detect emails of a certain flag (all, read only, unread only).
  • Changed: ExamineMailEx(): Added a new parameter to specify whether only header data or all data should be determined.
Image
Image
User avatar
RSBasic
Moderator
Moderator
Posts: 1218
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: PB.Ex Mail (Windows)

Post by RSBasic »

PB.Ex Mail 1.0.9.0 has been released.

Changelog:
  • Changed: @Output$: If 0 is passed, then the required length for allocating the memory is returned as the return value of the respective function.
Image
Image
User avatar
RSBasic
Moderator
Moderator
Posts: 1218
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: PB.Ex Mail (Windows)

Post by RSBasic »

PB.Ex Mail 1.1.0.0 has been released.

Changelog:
  • Optimized: Performance
Image
Image
User avatar
RSBasic
Moderator
Moderator
Posts: 1218
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: PB.Ex Mail (Windows)

Post by RSBasic »

PB.Ex Mail 1.1.1.0 has been released.

Changelog:
  • Added: #PBEx_Mail_Protocol_SMTP for OpenMailEx()
  • Changed: SendMailEx(): The parameters (MailServer, Port, UserName, Password, SSL) have been removed.
  • Changed: SendMailEx(): The credentials are determined from OpenMailEx().
  • Changed: SendMailEx(): Now requires OpenMailEx().
  • Changed: SendMailFileEx(): The parameters (MailServer, Port, UserName, Password, SSL) have been removed.
  • Changed: SendMailFileEx(): The credentials are determined from OpenMailEx().
  • Changed: SendMailFileEx(): Now requires OpenMailEx().
Image
Image
User avatar
RSBasic
Moderator
Moderator
Posts: 1218
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: PB.Ex Mail (Windows)

Post by RSBasic »

PB.Ex Mail 1.1.2.0 has been released.

Changelog:
  • Changed: OpenMailEx(): If #PB_Any is used, the ID starts at 1.
Image
Image
Post Reply