Sammlung aller PureBasic Extensions by RSBasic
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

199 lines
11 KiB

EnableExplicit
Global PBEx_Mail
#PBEx_Mail_Protocol_IMAP = 0
#PBEx_Mail_Protocol_POP3 = 1
#PBEx_Mail_Priority_Normal = 0
#PBEx_Mail_Priority_Low = 1
#PBEx_Mail_Priority_High = 2
#PBEx_Mail_Event_NewMail = 0
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, 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, 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, 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, MailServer.p-Unicode, Port, UserName.p-Unicode, Password.p-Unicode, SSL, Subject.p-Unicode, Body.p-Unicode, Priority, From.p-Unicode, ToAddress.p-Unicode, CC.p-Unicode, BCC.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, MailServer.p-Unicode, Port, UserName.p-Unicode, Password.p-Unicode, SSL, Path.p-Unicode, ErrorOutput)
Global SendMailFileEx.SendMailFileEx = GetFunction(PBEx_Mail, "SendMailFileEx")
EndIf
Global Output$ = Space(1000000)
Global ErrorOutput$ = ""
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, @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, @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 "--------------------------------------------------"
; Wend
;
; EndIf
CloseMailEx(1, @ErrorOutput$)
Else
Debug ErrorOutput$
EndIf
CloseLibrary(PBEx_Mail)
; IDE Options = PureBasic 5.60 (Windows - x64)
; CursorPosition = 145
; FirstLine = 117
; Folding = -
; EnableXP
; EnableUser
; Executable = PB.Ex_MSSQL.exe
; CompileSourceDirectory
; EnableCompileCount = 650
; EnableBuildCount = 7
; EnableUnicode

Impressum | Datenschutz