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: 268
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.30 64 bits - Windows 11 Pro 64 bits 25H2
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: 268
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.30 64 bits - Windows 11 Pro 64 bits 25H2
User avatar
GG
Enthusiast
Enthusiast
Posts: 268
Joined: Tue Jul 26, 2005 12:02 pm
Location: Lieusaint (77), France

Re: PB.Ex Mail (Windows)

Post by GG »

Hi All,

trying to play with Yahoo Mailbox, and trying to read mails which are in a METEO Yahoo mail directory.
When I connect with openSSL to my Yahoo mailbox, directories are visible like this :

* OK Welcome! IMAP Server up and ready to accept your request
a2 LOGIN xxx@yahoo.fr abcde
a2 OK [CAPABILITY IMAP4rev1 ID MOVE NAMESPACE XYMHIGHESTMODSEQ UIDPLUS LITERAL+ CHILDREN UNSELECT X-MSG-EXT OBJECTID IDLE ENABLE UIDONLY X-UIDONLY LIST-EXTENDED LIST-STATUS SPECIAL-USE MESSAGELIMIT=1000 PARTIAL APPENDLIMIT=41697280] LOGIN completed
a3 LIST "" "*"
* LIST (\Archive \HasNoChildren) "/" "Archive"
* LIST (\Junk \HasNoChildren) "/" "Bulk"
* LIST (\Drafts \HasNoChildren) "/" "Draft"
* LIST (\HasNoChildren) "/" "METEO"
* LIST (\Sent \HasNoChildren) "/" "Sent"
* LIST (\Trash \HasNoChildren) "/" "Trash"

a3 OK LIST completed

Coding this (with PB 6.30 x64) doesn't allow me to read mails, I think I've missed something, but what...

Code: Select all

OpenConsole()
XIncludeFile("PB.Ex_Mail.pbi")
Global ErrorOutput$ = Space(128)
Global test.i, result.i, compteur.i
Global mail_directory$="METEO"
Global output$=Space(1000)
PrintN("Connection to Yahoo Mailbox")
test=OpenMailEx(1, #PBEx_Mail_Protocol_SMTP, "smtp.mail.yahoo.com", 465, "xxx@yahoo.fr", "abcdef", 1,#PBEx_Mail_ProtocolVersion_TLS13, @ErrorOutput$)
PrintN("affichage : "+Str(test)+" / "+erroroutput$);
If test
  result=SetMailDirectoryEx(1,mail_directory$,@ErrorOutput$)
  PrintN("result : "+Str(result))
  compteur=0
  If ExamineMailEx(1, #PBEx_Mail_SeenType_AllMails, #PBEx_Mail_FetchType_OnlyHeaderData, 0, @ErrorOutput$)
    While NextMailEntryEx(1, @ErrorOutput$)
      compteur=compteur+1
      PrintN("=================================")
      PrintN("Mail No "+Str(compteur))
      MailEntrySubjectEx(1, @Output$, @ErrorOutput$)
      PrintN("output : "+output$+" / erroroutput : "+erroroutput$)
    Wend
  EndIf
EndIf
CloseMailEx(1, @ErrorOutput$)
Even with Imap connection :

Code: Select all

test=OpenMailEx(1, #PBEx_Mail_Protocol_IMAP, "imap.mail.yahoo.com", 993, "xxx@yahoo.fr", "abcde", 1,#PBEx_Mail_ProtocolVersion_TLS13, @ErrorOutput$)
Thanks a lot in advance for your help.
Purebasic 6.30 64 bits - Windows 11 Pro 64 bits 25H2
Post Reply