Closed kskolte2020 closed 1 year ago
Can you post example code you were trying to use ?
mail = ImapSmtp(smtp_server="smtp.gmail.com", smtp_port=587)
mail.authorize(account=__gmail_account, password=__gmail_password)
if not inbox_folder:
mails = mail.list_messages(mail_criteria, source_folder='GmailFolderName')
print(mails)
else:
mails = mail.list_messages(mail_criteria, source_folder='Inbox')
I tried to print mails variable, but bcz of error it was getting into exception block.
And your mail_criteria
is some sort of string ?
And what is the specific Python version you are using ? Python version should be determined by x.yz version number like 3.8.7
and not just 3.8
.
And your
mail_criteria
is some sort of string ?
Yes, it's a string.
And what is the specific Python version you are using ? Python version should be determined by x.yz version number like
3.8.7
and not just3.8
.
My apologies, it's 3.8.3
I run your example with rpaframework versions 13.0.0 and 13.2.0 without problems.
from RPA.Email.ImapSmtp import ImapSmtp
from RPA.Robocorp.Vault import Vault
def list_emails(mail_criteria, inbox_folder=True):
secrets = Vault().get_secret("gmailtest")
mail = ImapSmtp(smtp_server="smtp.gmail.com", smtp_port=587)
mail.authorize(account=secrets["username"], password=secrets["password"])
if not inbox_folder:
mails = mail.list_messages(mail_criteria, source_folder="custom name")
print(mails)
else:
mails = mail.list_messages(mail_criteria, source_folder="INBOX")
print(mails)
def minimal_task():
list_emails('SUBJECT "New Test Email from Friday 25/MAR/22"')
print("Done.")
if __name__ == "__main__":
minimal_task()
I run your example with rpaframework versions 13.0.0 and 13.2.0 without problems.
from RPA.Email.ImapSmtp import ImapSmtp from RPA.Robocorp.Vault import Vault def list_emails(mail_criteria, inbox_folder=True): secrets = Vault().get_secret("gmailtest") mail = ImapSmtp(smtp_server="smtp.gmail.com", smtp_port=587) mail.authorize(account=secrets["username"], password=secrets["password"]) if not inbox_folder: mails = mail.list_messages(mail_criteria, source_folder="custom name") print(mails) else: mails = mail.list_messages(mail_criteria, source_folder="INBOX") print(mails) def minimal_task(): list_emails('SUBJECT "New Test Email from Friday 25/MAR/22"') print("Done.") if __name__ == "__main__": minimal_task()
It happened for me in few set of mail criteria, not all, however after downgrade that worked without errors
What kind of criteria do you mean?
What kind of criteria do you mean?
I got error in this two example criteria: 'Subject "Invoice" Subject "My Company" Unseen' and 'Subject "Invoice" Subject "My Industries & Co" Unseen'
Please re-open if the issue still exists.
Python Version: 3.8.3 rpaframework = 13.1.0
I found error while I was trying to download attachments from mails using RPA.Email.ImapSmtp in Python. Actually, updated the framework to latest version then I was getting error as
LookupError: unknown encoding: None
. Then I downgraded to v13.0.1 tracking the changes made, however I still got same error. Then finally I downgraded to v12.8.2 and that worked. So I guess there's error in v12.9.0 or in between 12.9.0 - 13.0.1