PB.Ex Mail (Windows)

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
alxfrnds
User
User
Posts: 10
Joined: Fri Jun 30, 2017 1:13 am

Re: PB.Ex Mail (Windows)

Post by alxfrnds »

Any way convert html email to plain text?
alxfrnds
User
User
Posts: 10
Joined: Fri Jun 30, 2017 1:13 am

Re: PB.Ex Mail (Windows)

Post by alxfrnds »

Any idea with this error trying to login hotmail/outlook:
"Authentication failed because the remote party has closed the transport stream."
User avatar
RSBasic
Moderator
Moderator
Posts: 1228
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: PB.Ex Mail (Windows)

Post by RSBasic »

alxfrnds wrote: Mon Jan 15, 2024 8:40 pm Any idea with this error trying to login hotmail/outlook:
"Authentication failed because the remote party has closed the transport stream."
I created a new Hotmail email address and tested it. Unfortunately, Hotmail is not supported.
Image
Image
User avatar
GG
Enthusiast
Enthusiast
Posts: 266
Joined: Tue Jul 26, 2005 12:02 pm
Location: Lieusaint (77), France

Re: PB.Ex Mail (Windows)

Post by GG »

Hi community,

I'm trying to read mails from gmail.

WIth the following simple code (replace gmail credentials by yours), only the date is printed. I don't know why "subject", "body", "from", "to" items are not printed.
And nothing also with ErrorOutput$
I'm missing something obvious but what...

PureBasic 6.04 x64, Windows 11 Pro X64 23H2.

Code: Select all

XIncludeFile("PB.Ex_Mail.pbi")

DisableExplicit
OpenMailEx(1, #PBEx_Mail_Protocol_IMAP, "imap.gmail.com", 993, "xxx.yyy@gmail.com", "blabla", 1,#PBEx_Mail_ProtocolVersion_TLS13, @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$
      Debug "ErrorOutput$ Subject:" + ErrorOutput$
      MailEntryFromEx(1, @Output$, @ErrorOutput$)
      Debug "From: " + Output$
      Debug "ErrorOutput$ From:" + ErrorOutput$
      MailEntryToEx(1, @Output$, @ErrorOutput$)
      Debug "To: " + Output$
      Debug "ErrorOutput$ To:" + ErrorOutput$
      Debug "Date: " + FormatDate("%dd.%mm.%yyyy %hh:%ii:%ss", MailEntryDateEx(1, @ErrorOutput$))
      Debug MailIDEx(1, @ErrorOutput$)
      MailEntryBodyEx(1, @Output$, @ErrorOutput$)
      Debug "Body: "+Output$
      Debug "ErrorOutput$ Body:" + ErrorOutput$
      
      
      Debug "--------------------------------------------------"
    Wend
   
  EndIf
;...
Result :
Subject:
ErrorOutput$ Subject:
From:
ErrorOutput$ From:
To:
ErrorOutput$ To:
Date: 01.03.2024 18:22:32
1
Body:
ErrorOutput$ Body:
0
--------------------------------------------------
Subject:
ErrorOutput$ Subject:
From:
ErrorOutput$ From:
To:
ErrorOutput$ To:
Date: 01.03.2024 18:27:14
2
Body:
ErrorOutput$ Body:
74
--------------------------------------------------
Subject:
ErrorOutput$ Subject:
From:
ErrorOutput$ From:
To:
ErrorOutput$ To:
Date: 01.03.2024 18:27:20
3
Body:
ErrorOutput$ Body:
143
--------------------------------------------------
Subject:
ErrorOutput$ Subject:
From:
ErrorOutput$ From:
To:
ErrorOutput$ To:
Date: 01.03.2024 18:34:21
4
Body:
ErrorOutput$ Body:
214
--------------------------------------------------
Subject:
ErrorOutput$ Subject:
From:
ErrorOutput$ From:
To:
ErrorOutput$ To:
Date: 13.03.2024 11:29:42
26
Body:
ErrorOutput$ Body:
293
--------------------------------------------------
Subject:
ErrorOutput$ Subject:
From:
ErrorOutput$ From:
To:
ErrorOutput$ To:
Date: 14.03.2024 00:17:07
27
Body:
ErrorOutput$ Body:
368
--------------------------------------------------
Subject:
ErrorOutput$ Subject:
From:
ErrorOutput$ From:
To:
ErrorOutput$ To:
Date: 14.03.2024 01:59:37
28
Body:
ErrorOutput$ Body:
436
--------------------------------------------------
Subject:
ErrorOutput$ Subject:
From:
ErrorOutput$ From:
To:
ErrorOutput$ To:
Date: 14.03.2024 11:36:16
29
Body:
ErrorOutput$ Body:
503
--------------------------------------------------
Purebasic 6.12 64 bits - Windows 11 Pro 64 bits 23H2
User avatar
RSBasic
Moderator
Moderator
Posts: 1228
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: PB.Ex Mail (Windows)

Post by RSBasic »

Hello GG

Try with:

Code: Select all

XIncludeFile("PB.Ex_Mail.pbi")

Global Output$ = Space(1000000)
Global ErrorOutput$ = Space(128)

OpenMailEx(1,...
Image
Image
User avatar
GG
Enthusiast
Enthusiast
Posts: 266
Joined: Tue Jul 26, 2005 12:02 pm
Location: Lieusaint (77), France

Re: PB.Ex Mail (Windows)

Post by GG »

Pffff...
Thank you RSBasic and sorry for the inconvenience... :oops:
It works perfectly !

Below the corrected code :

Code: Select all

XIncludeFile("PB.Ex_Mail.pbi")

Global Output$ = Space(1000000)
Global ErrorOutput$ = Space(128)

OpenMailEx(1, #PBEx_Mail_Protocol_IMAP, "imap.gmail.com", 993, "xxx.yyy@gmail.com", "blabla", 1,#PBEx_Mail_ProtocolVersion_TLS13, @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$
      Debug "ErrorOutput$ Subject:" + ErrorOutput$
      MailEntryFromEx(1, @Output$, @ErrorOutput$)
      Debug "From: " + Output$
      Debug "ErrorOutput$ From:" + ErrorOutput$
      MailEntryToEx(1, @Output$, @ErrorOutput$)
      Debug "To: " + Output$
      Debug "ErrorOutput$ To:" + ErrorOutput$
      Debug "Date: " + FormatDate("%dd.%mm.%yyyy %hh:%ii:%ss", MailEntryDateEx(1, @ErrorOutput$))
      Debug MailIDEx(1, @ErrorOutput$)
      MailEntryBodyEx(1, @Output$, @ErrorOutput$)
      Debug "Body: "+Output$
      Debug "ErrorOutput$ Body:" + ErrorOutput$
      
      
      Debug "--------------------------------------------------"
    Wend
   
  EndIf
Purebasic 6.12 64 bits - Windows 11 Pro 64 bits 23H2
Post Reply