PB.Ex Mail (Windows)

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
Little_man
Enthusiast
Enthusiast
Posts: 152
Joined: Fri Mar 29, 2013 4:55 pm
Location: The Netherland

Re: PB.Ex Mail (Windows)

Post by Little_man »

RSBasic,

A strange error occurs when updating to "PB.Ex Mail 1.1.5.0" in Windows 10 Home, x64.
After putting back "PB.Ex_Mail_x64.dll 1.1.3.0" the strange error has disappeared !!...

Kind regards
Little_man
drgolf
Enthusiast
Enthusiast
Posts: 106
Joined: Tue Mar 03, 2009 3:40 pm
Location: france

Re: PB.Ex Mail (Windows)

Post by drgolf »

Hello,

Please, is it possible to have TLS protocol 1.3 ?
I cant access my mails on my GMX mailbox... (SSPI call error is returned... ?)

The DLL works fine with other mailbox... Thanks !!
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 »

Little_man wrote: Wed Dec 22, 2021 10:36 pm RSBasic,

A strange error occurs when updating to "PB.Ex Mail 1.1.5.0" in Windows 10 Home, x64.
After putting back "PB.Ex_Mail_x64.dll 1.1.3.0" the strange error has disappeared !!...

Kind regards
Little_man
Hello
Sorry for the late reply.
What error occurs?
Image
Image
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 »

PB.Ex Mail 1.1.6.0 has been released.

Changelog:
  • Updated: .NET Framework 4.5.2 > .NET Framework 4.8 (required for TLS 1.3)
  • Added: TLS 1.3 support

drgolf wrote: Tue Jun 20, 2023 1:43 pm Please, is it possible to have TLS protocol 1.3 ?
Done, I added TLS 1.3 support.
drgolf wrote: Tue Jun 20, 2023 1:43 pm I cant access my mails on my GMX mailbox... (SSPI call error is returned... ?)
I can confirm it with my GMX account (also with TLS 1.3) but I have no solution. :(
The following exception occurs:
A call to SSPI failed, see inner exception:
System.ComponentModel.Win32Exception (0x80004005): The function requested not supported
bei System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, Exception exception)
bei System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
bei System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
bei System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
bei System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
bei System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest, Boolean renegotiation)
bei System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)
bei System.Net.Security.SslStream.AuthenticateAsClient(String targetHost)
bei S22.Imap.ImapClient.Connect(String hostname, Int32 port, Boolean ssl, RemoteCertificateValidationCallback validate)
bei S22.Imap.ImapClient..ctor(String hostname, Int32 port, String username, String password, AuthMethod method, Boolean ssl, RemoteCertificateValidationCallback validate)
bei PBEx._OpenMailEx(Int32 ID, Int32 Protocol, String MailServer, Int32 Port, String UserName, String Password, Int32 SSL)

Void StartSendAuthResetSignal(System.Net.Security.ProtocolToken, System.Net.AsyncProtocolRequest, System.Exception)
If I run my class library in Windows Forms it works without SSPI errors, but in PureBasic I get the SSPI error. I don't know. :(
Anyone an idea?
drgolf wrote: Tue Jun 20, 2023 1:43 pm The DLL works fine with other mailbox... Thanks !!
Which provider does it work?
Image
Image
drgolf
Enthusiast
Enthusiast
Posts: 106
Joined: Tue Mar 03, 2009 3:40 pm
Location: france

Re: PB.Ex Mail (Windows)

Post by drgolf »

Hello,

Very thanx for the update.
The DLL work with IKMAIL (infomaniak) but dont work anymore with Orange or GMX.
TLS 1.3 dont work too, but IKMAIL continue working.

I have message : Error: Échec d'un appel à SSPI, consultez l'exception interne on GMX...

The DLL work in june but in july no.

I have used Libcurl and IMAP for access mail box.

Maybe a parameter missing ?
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 »

drgolf wrote: Thu Aug 31, 2023 1:43 pm Maybe a parameter missing ?
All required data will be sent.
drgolf wrote: Thu Aug 31, 2023 1:43 pm The DLL work in june but in july no.
That is very strange. Maybe there was a certificate change.

I tested with the following mail providers:
  • ❌ GMX (belongs to IONOS)
  • ❌ Web.de (belongs to IONOS)
  • ❌ Orange.fr
  • ❌ Strato (belongs to IONOS)
  • ❌ IONOS
  • ❌ T-Online
  • ❌ Hotmail
  • ✅ Google Mail
  • ✅ Hosting.de
  • ✅ Outlook
  • ✅ Mail.de
  • ✅ Yahoo
  • ✅ Freenet
  • ✅ AOL
  • ✅ Vodafone
  • ✅ 1blu
  • ✅ emailn.de
  • ✅ Mailbox
Image
Image
drgolf
Enthusiast
Enthusiast
Posts: 106
Joined: Tue Mar 03, 2009 3:40 pm
Location: france

Re: PB.Ex Mail (Windows)

Post by drgolf »

Somebody tell me that in place using :

Code: Select all

client.Connect(host,port,false);
use :

Code: Select all

client.Connect(host,port,SecureSocketOptions.None);
Maybe this help.
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 everybody,
I'm trying to find the root cause of the extreme slowness when retrieving Gmail mails (14 seconds for each mail). 65 mails with only some text in the subject / title (50 chars).
Using this excellent lib since 2019, no problems since last days.

I've updated to last version (1.1.6.0 Pb Ex Mail, before 1.1.3.0), using PB 6.02 x64 under Windows 10 X64, same problems. Using TLS 1.3, with SSL enabled : Are these rights parameters for gmail mailbox ? However, Mails are well retrieved, but with slowness.

When looking a little bit further, the following command :

Code: Select all

ExamineMailEx(1, #PBEx_Mail_SeenType_AllMails, #PBEx_Mail_FetchType_AllData, 0, @ErrorOutput$)
takes 14 seconds to execute (before maybe 2 or 3 seconds).

I tried the

Code: Select all

#PBEx_Mail_FetchType_OnlyHeaderData 
flag instead of

Code: Select all

#PBEx_Mail_FetchType_AllData
, a little bit better (from 14 to 7 seconds)...

The command used to open mailbox is :

Code: Select all

OpenMailEx(1, #PBEx_Mail_Protocol_IMAP, imap_server_name$, Val(imap_server_port$), imap_userid$, imap_password$, Val(ssl$),#PBEx_Mail_ProtocolVersion_TLS13, @ErrorOutput$)
Do you have any idea ? Already encountered this case ?

Thanks a lot in advance !

Gaëtan
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

I tested with my Google account. I have 260 emails in my inbox.

For each email with #PBEx_Mail_FetchType_OnlyHeaderData and without get attachments: 500-600 milliseconds
For each email with #PBEx_Mail_FetchType_AllData and without get attachments: 600-700 milliseconds
For each email with #PBEx_Mail_FetchType_OnlyHeaderData and with get attachments: 800-900 milliseconds
For each email with #PBEx_Mail_FetchType_AllData and with get attachments: 900-1000 milliseconds

I have no idea why it's slow for you.

My test code:

Code: Select all

;...
If ExamineMailEx(1, #PBEx_Mail_SeenType_AllMails, #PBEx_Mail_FetchType_OnlyHeaderData, 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 ElapsedMilliseconds() - StartTime
      StartTime.q = ElapsedMilliseconds()
      
      Debug "--------------------------------------------------"
    Wend
   
  EndIf
;...
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 »

Hello RSBasic,

Things are getting better, I retrieved "normal" timings, I suppose it came from Google, no changes from my part.
Thanks again for your lib and support.
Purebasic 6.12 64 bits - Windows 11 Pro 64 bits 23H2
BarryG
Addict
Addict
Posts: 4121
Joined: Thu Apr 18, 2019 8:17 am

Re: PB.Ex Mail (Windows)

Post by BarryG »

Tried this code again to read my Gmail Inbox (using IMAP) and it connects, but nothing is output. That is, none of the code between "While NextMailEntryEx(1, @PBEx_Mail_ErrorOutput$)" and "Wend" is executed, so I don't get the Debug output of "Subject" etc. Any ideas?
User avatar
captain_skank
Enthusiast
Enthusiast
Posts: 639
Joined: Fri Oct 06, 2006 3:57 pm
Location: England

Re: PB.Ex Mail (Windows)

Post by captain_skank »

Hi and a Happy 2024,

Going to sound like a silly question, but when using :

Result = SendMailEx(ID, Subject$, Body$, Priority, From$, ToAddress$, CC$, BCC$, Attachments$, @ErrorOutput$)

How do format the text for the Body$ ?

I thought using #crlf$ would insert linebreaks but it doesn't.

Any help appreciated.

Cheers
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 captain_skank

HTML code is used by default. I.e. if you want to insert line breaks: <br>
Image
Image
User avatar
captain_skank
Enthusiast
Enthusiast
Posts: 639
Joined: Fri Oct 06, 2006 3:57 pm
Location: England

Re: PB.Ex Mail (Windows)

Post by captain_skank »

RSBasic wrote: Thu Jan 04, 2024 2:44 pm Hello captain_skank

HTML code is used by default. I.e. if you want to insert line breaks: <br>
Sorry for the delay in replying, works like a charm.

Thanks muchly.
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 »

Yes, you'll need to create an app password for your application in Gmail. Then you can use it in PureBasic: https://support.google.com/mail/answer/185833?hl=en

\\Edit:
The question has disappeared. :D
Image
Image
Post Reply