1

I'm trying to get this G1ANT robot to retrieve unread emails from a test email ID, however the retrieved list ♥list has a count of zero even when there are two unread emails. How do I get around this? No error messages are displayed as well.

I tried using imap.getemails instead of mail.imap command also, yet it returns the same results. Here is the code for that line:

mail.imap imap.getmails host imap.gmail.com port 993 login ♥login password ♥password onlyunreadmessages true sincedate ♥date ignorecertificateerrors true result ♥list

IMAP is enabled on the email address.

Here is the code:

addon net version 4.101.0.0
addon selenium version 4.101.0.0
addon core version 4.101.0.0
addon language version 4.103.0.0

♥login=idgoeshere
♥password=passwordhere

mail.imap imap.gmail.com login ♥login password ♥password sincedate ♥date onlyunreadmessages true ignorecertificateerrors true result ♥list

foreach ♥email in ♥list
    dialog ♥email
end

No error messages were shown, simply the automation ends.

Wiktoria Prusik
  • 840
  • 4
  • 15
VIGNESH N
  • 208
  • 1
  • 7

2 Answers2

2

The problem is that ♥date is a special variable in G1ANT containing the today date. It means that it can't find any emails after today because there was no day after today yet.

Use some direct value instead, for example 16/08/2019 and be sure to use errorcall argument as you will probably encounter the exception:

The folder is not currently open in read-write mode.

You can just ignore it by creating an empty procedure like in the following.

mail.imap imap.gmail.com login ♥login password ♥password sincedate ‴16/08/2019‴ onlyunreadmessages true ignorecertificateerrors true errorcall IgnoreError

foreach ♥email in ♥result
    dialog ♥email
end

procedure IgnoreError
end procedure
Wiktoria Prusik
  • 840
  • 4
  • 15
1

Please use new imap command.

imap.open imap.gmail.com login ♥login password ♥password ignorecertificateerrors true
imap.getmails
imap.close
  • The commands aren't recognized in G1ANT Studio. I am using the latest exe from the website. – VIGNESH N Sep 13 '19 at 06:22
  • 1
    @VIGNESHN don't worry about it. G1ANT is going to release a new version soon (you can see the source code on github) and in the meantime, you can use the mail.imap command in the way that I posted just a second ago. – Wiktoria Prusik Sep 17 '19 at 12:57