问题
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.
回答1:
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
回答2:
Please use new imap command.
imap.open imap.gmail.com login ♥login password ♥password ignorecertificateerrors true
imap.getmails
imap.close
来源:https://stackoverflow.com/questions/57801125/how-to-fix-g1ant-imap-not-retrieving-any-emails