Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - bwill

Pages: [1]
1
Email Protocols / Re: Gmail only shows and downloads 2000 mails
« on: May 22, 2018, 12:29:19 PM »
Thanks, this was what I was looking for.

Regards

Beatrix Willius

2
Email Protocols / Gmail only shows and downloads 2000 mails
« on: May 18, 2018, 09:44:49 AM »
Got an odd problem with Gmail. I don't think it's a Chilkat problem.

The user has about 13k mails in his inbox. When I get the number of mails in his inbox it's exactly 2000 mails and not 13k. I read about Gmail having limitations on sending email. But I didn't find anything concrete about downloading mails. Any ideas if this is a preferences setting in Gmail?

Regards

Beatrix Willius

3
Auth / Re: OAuth and what then?
« on: March 23, 2018, 03:10:04 AM »
Hi,

yes, I made sure that the account names match. And no dice, I still can't get this to work.

Stupid questions:
- I need to supply the full token with the json including the brackets?
- Is there a chance that the encoding matters or the EOLs or an empty space at the end?

Mit freundlichen Grüßen/Regards

Beatrix Willius

http://www.mothsoftware.com
Mail Archiver X: The email archiving solution for professionals

4
Auth / Re: OAuth and what then?
« on: March 19, 2018, 07:28:37 AM »
Still no luck with the code:

Code: [Select]
dim Token as String = setTokenGmail '<-- set the token, this works fine

CkoImap = new Chilkat.Imap
CkoImap.Ssl = True
CkoImap.Port = 993

dim success as Boolean = CkoImap.Connect(ServerName)
if not success then
  System.DebugLog(CkoImap.LastErrorText)
  Return "loginfailed"
end if

CkoImap.AuthMethod = "XOAUTH2"

'Login, Use the email address of the GMail account that granted authorization.
success = CkoImap.Login(UserName + "@gmail.com", Token)
If (success <> True) Then '<----- success is false here
  System.DebugLog(CkoImap.LastErrorText)
Else
  System.DebugLog("Successfully authenticate with GMail IMAP using XOAUTH2!")
End If

Last response is:
+ eyJzdGF0dXMiOiI0MDAiLCJzY2hlbWVzIjoiQmVhcmVyIiwic2NvcGUiOiJodHRwczovL21haWwuZ29vZ2xlLmNvbS8ifQ==
aaab NO [AUTHENTICATIONFAILED] Invalid credentials (Failure)

I tried with 2 different accounts. What am I doing wrong?

Mit freundlichen Grüßen/Regards

Beatrix Willius

http://www.mothsoftware.com
Mail Archiver X: The email archiving solution for professionals

5
Auth / Re: OAuth and what then?
« on: March 19, 2018, 06:31:41 AM »
Thanks!

Mit freundlichen Grüßen/Regards

Beatrix Willius

http://www.mothsoftware.com
Mail Archiver X: The email archiving solution for professionals

6
Auth / Re: OAuth and what then?
« on: March 17, 2018, 05:52:06 AM »
I've overlooked the example https://www.example-code.com/xojo/gmail_smtp_send_using_oauth2_token.asp . Which is for sending mail. Here is the most important part:

Code: [Select]
mailman.OAuth2AccessToken = accessToken
However, Chilkat.Imap doesn't have this mailman.OAuth2AccessToken property. What am I missing?

Mit freundlichen Grüßen/Regards

Beatrix Willius

http://www.mothsoftware.com
Mail Archiver X: The email archiving solution for professionals

7
Auth / OAuth and what then?
« on: March 17, 2018, 05:28:42 AM »
Hi,

I've successfully connected with OAuth to Gmail. But what comes afterwards?

I understand where I've got the access token and I'm supposed to save it.

Code: [Select]
Dim sbJson As New Chilkat.StringBuilder
sbJson.Append(oauth2.AccessTokenResponse)
sbJson.WriteFile("qa_data/tokens/_gmailSmtp.json","utf-8",False)

The next time I need to log in I would guess that I need this somewhere. But where? How do I use this instead of trying to log in again? Something like

Code: [Select]
if got access token then
 load access token from preferences into oauth
else
  do the connect stuff
end if

But even when being logging in getting the mailboxes fails. The code below:

Code: [Select]
CkoMailboxTask = CkoImap.ListMailboxesAsync("", "*")
call CkoMailboxTask.Run
While CkoMailboxTask.Finished <> True
  if globals.StopArchiving then
    if not CkoMailboxTask.Cancel then app.SleepCurrentThread(10)
    Return Nil
  end if
  CkoMailboxTask.SleepMs(25)
wend

if not CkoMailboxTask.TaskSuccess then
  globals.theErrorLog.LogItem(CurrentMethodName + " task didn't finish")
  Return Nil
end if

dim CkoMailboxes as new Chilkat.Mailboxes
if not CkoMailboxes.LoadTaskResult(CkoMailboxTask) then
  globals.theErrorLog.LogItem(CurrentMethodName + " wasn't able to load result from task") '<------ no mailboxes
  Retur
n Nil
end if

fails when loading the result of the task. A simple

dim theM as Chilkat.Mailboxes = CkoImap.ListMailboxes("", "*")

also doesn't work. Do I need to connect the Oauth to Chilkat.Imap?

Xojo 2017r3, 64bit, macOS 10.11., Chilkat plugin from feb 2018.

Mit freundlichen Grüßen/Regards

Beatrix Willius

http://www.mothsoftware.com
Mail Archiver X: The email archiving solution for professionals


8
Xojo / Still problems
« on: December 01, 2017, 01:02:36 AM »
I still haven't solved the problem that we discussed at http://chilkatforum.com/questions/12921/another-empty-mail-with-fetchsingleasmimeasync

This occurs for me again. Also I've got 2 customers with the same problem.

You said

Quote
I tested, and everything looked fine to me. The email in question is a multipart/alternative, but with only one alternative body, which is a text/plain body. There is no HTML body in this particular email. You can examine the MIME. If you're calling a method such as email.GetHtmlBody, then it will certainly return nothing because there's no HTML body..

See https://www.example-code.com/xojo/email_body.asp

One can't assume an HTML body exists (or that a plain-text body exists..)

Does that explain the problem, or is it something else?

However, this doesn't explain my problems.

- The problem always occurs for me for the same mail.
- I'm using FetchSingleAsMimeAsync and the result is blank. No email.GetHtmlBody involved.
- The mails on the test account don't change much. There are no new mails.

Am I doing something wrong?

1) I do a message set and count the mails:

  CkoMessageSet = new Chilkat.MessageSet
  CkoMessageSet = CkoImap.Search("NOT DELETED", True)
  NoOfMails = CkoMessageSet.Count

2) I get number of headers and check if the mails are available in the database or not.

3) If the mail is not in the database then I get the mail:

Code: [Select]
dim messageID as Integer = CkoMessageSet.getID(counter - 1)
CkoMailTask = CkoImap.FetchSingleAsMimeAsync(messageID, True)
CkoImap.ReadTimeout = 60
call CkoMailTask.run
While CkoMailTask.Finished <> true
  CkoMailTask.SleepMs(50)
wend

if not CkoMailTask.TaskSuccess then
  Globals.theErrorLog.LogItem(CurrentMethodName + " " + MailboxPath +  " task didn't finish")
  Return ""
end if

dim theBody as String = CkoMailTask.GetResultString
'theBody is empty here

Regards

Beatrix Willius

Pages: [1]