Authorize

Authorize user to SMTP and IMAP servers.

Arguments

Argument Type Default value Description
account str Noneuser account as string, defaults to None
password str Noneuser password as string, defaults to None
smtp_server str NoneSMTP server address, defaults to None
imap_server str NoneIMAP server address, defaults to None
smtp_port int NoneSMTP server port, defaults to None (587 for SMTP)
imap_port int NoneIMAP server port, defaults to None
param account:user account as string, defaults to None
param password:user password as string, defaults to None
param smtp_server:
 SMTP server address, defaults to None
param imap_server:
 IMAP server address, defaults to None
param smtp_port:
 SMTP server port, defaults to None (587 for SMTP)
param imap_port:
 IMAP server port, defaults to None

Will use separately set credentials or those given in keyword call.

Examples

*** Tasks ***
Authorize    ${username}   ${password}  smtp_server=smtp.gmail.com  smtp_port=587

Authorize Imap

Authorize to IMAP server.

Arguments

Argument Type Default value Description
account str NoneIMAP account name, defaults to None
password str NoneIMAP account password, defaults to None
imap_server str NoneIMAP server address, defaults to None
imap_port int NoneIMAP server port, defaults to None
param account:IMAP account name, defaults to None
param password:IMAP account password, defaults to None
param imap_server:
 IMAP server address, defaults to None
param imap_port:
 IMAP server port, defaults to None

Can be called without giving any parameters if library has been initialized with necessary information and/or keyword Set Credentials has been called.

Examples

*** Tasks ***
Authorize IMAP    ${username}   ${password}  imap.gmail.com  993

Authorize Smtp

Authorize to SMTP server.

Arguments

Argument Type Default value Description
account str NoneSMTP account name, defaults to None
password str NoneSMTP account password, defaults to None
smtp_server str NoneSMTP server address, defaults to None
smtp_port int NoneSMTP server port, defaults to None (587 for SMTP)
param account:SMTP account name, defaults to None
param password:SMTP account password, defaults to None
param smtp_server:
 SMTP server address, defaults to None
param smtp_port:
 SMTP server port, defaults to None (587 for SMTP)

Can be called without giving any parameters if library has been initialized with necessary information and/or keyword Set Credentials has been called.

Examples

*** Tasks ***
Authorize SMTP    ${username}   ${password}  smtp.gmail.com  587

Create Folder

Create email folder

Arguments

Argument Type Default value Description
folder_name str Nonename for the new folder
param folder_name:
 name for the new folder
return:True if operation was successful, False if not

Examples

*** Tasks ***
Create Folder   filtered

Delete Folder

Delete email folder

Arguments

Argument Type Default value Description
folder_name str Nonecurrent folder name
param folder_name:
 current folder name
return:True if operation was successful, False if not

Examples

*** Tasks ***
Delete Folder   filtered

Delete Message

Delete single message from server based on criterion.

Arguments

Argument Type Default value Description
criterion str filter messages based on this, defaults to ""
param criterion:
 filter messages based on this, defaults to ""
return:True if success, False if not

If criterion does not return exactly 1 message then delete is not done.

Examples

*** Tasks ***
Delete Message  SUBJECT "Greetings RPA developer"

Delete Messages

Delete messages from server based on criterion.

Arguments

Argument Type Default value Description
criterion str filter messages based on this, defaults to ""
param criterion:
 filter messages based on this, defaults to ""
return:True if success, False if not

Examples

*** Tasks ***
Delete Messages  SUBJECT Greetings

Flag Messages

Mark messages as flagged

Arguments

Argument Type Default value Description
criterion str Nonemark messages matching criterion
unflag bool Falseto mark messages as not flagged
param criterion:
 mark messages matching criterion
param unflag:to mark messages as not flagged
return:successful operations (int), matching messages (int)

Examples

*** Tasks ***
${flagged}  ${oftotal}    Flag Messages   SUBJECT rpa
${unflagged}  ${oftotal}  Flag Messages   SUBJECT rpa  unflag=True

Get Folder List

Get list of folders on the server

Arguments

Argument Type Default value Description
subdirectory str Nonelist subdirectories for this folder
pattern str Nonelist folders matching this pattern
param subdirectory:
 list subdirectories for this folder
param pattern:list folders matching this pattern
return:list of folders

Examples

*** Tasks ***
@{folders}  Get Folder List
@{folders}  Get Folder List  pattern=important
@{folders}  Get Folder List  subdirectory=sub

List Messages

Return list of messages matching criterion.

Arguments

Argument Type Default value Description
criterion str list emails matching this, defaults to ""
param criterion:
 list emails matching this, defaults to ""
return:list of messages or False

Examples

*** Tasks ***
@{emails}  List Messages  SUBJECT "rpa task"
FOR  ${email}  IN  @{EMAILS}
    Log  ${email}[Subject]
    Log  ${email}[From]
    Log  ${email}[Date]
    Log  ${email}[Delivered-To]
    Log  ${email}[Received]
    Log  ${email}[Has-Attachments]
END

Mark As Read

Mark messages as read

Arguments

Argument Type Default value Description
criterion str Nonemark messages matching criterion
unread bool Falseto mark messages as not read
param criterion:
 mark messages matching criterion
param unread:to mark messages as not read
return:successful operations (int), matching messages (int)

Examples

*** Tasks ***
${read}  ${oftotal}  Mark As Read   SUBJECT rpa

Mark As Unread

Mark messages as not read

Arguments

Argument Type Default value Description
criterion str Nonemark messages matching criterion
param criterion:
 mark messages matching criterion
return:successful operations (int), matching messages (int)

Examples

*** Tasks ***
${unread}  ${oftotal}  Mark As Unread   SUBJECT rpa

Rename Folder

Rename email folder

Arguments

Argument Type Default value Description
oldname str Nonecurrent folder name
newname str Nonenew name for the folder
suppress_error bool Falseto silence warning message, defaults to False
param oldname:current folder name
param newname:new name for the folder
param suppress_error:
 to silence warning message, defaults to False
return:True if operation was successful, False if not

Examples

*** Tasks ***
Rename Folder   subfolder   filtered

Save Attachment

Save mail attachment into local folder

Arguments

Argument Type Default value Description
messagemessage item
target_folderlocal folder for saving attachments to (needs to exist), defaults to user's home directory if None
overwriteoverwrite existing file is True, defaults to False
param message:message item
param target_folder:
 local folder for saving attachments to (needs to exist), defaults to user's home directory if None
param overwrite:
 overwrite existing file is True, defaults to False

Examples

*** Tasks ***
@{emails}  List Messages  SUBJECT "rpa task"
FOR  ${email}  IN  @{EMAILS}
    Run Keyword If   ${email}[Has-Attachments] == True
    ...              Save Attachment  ${email}  target_folder=${CURDIR}  overwrite=True
END

Save Attachments

Save mail attachments into local folder.

Arguments

Argument Type Default value Description
criterion str attachments are saved for mails matching this, defaults to ""
target_folder str Nonelocal folder for saving attachments to (needs to exist), defaults to user's home directory if None
overwrite bool Falseoverwrite existing file is True, defaults to False
param criterion:
 attachments are saved for mails matching this, defaults to ""
param target_folder:
 local folder for saving attachments to (needs to exist), defaults to user's home directory if None
param overwrite:
 overwrite existing file is True, defaults to False
return:list of saved attachments or False

Examples

*** Tasks ***
${numsaved}  Save Attachments   SUBJECT "rpa task"
...          target_folder=${CURDIR}${/}messages  overwrite=True

Save Messages

Save messages based on criteria and store them to target folder with attachment files.

Arguments

Argument Type Default value Description
criterion str filter messages based on this, defaults to ""
target_folder str Nonepath to folder where message are saved, defaults to None

Save messages based on criteria and store them to target folder with attachment files.

Does not save message if target_folder is not given.

param criterion:
 filter messages based on this, defaults to ""
param target_folder:
 path to folder where message are saved, defaults to None
return:True if success, False if not

Examples

*** Tasks ***
Save Messages  SUBJECT Important message  target_folder=${USERDIR}${/}messages

Select Folder

Select folder by name

Arguments

Argument Type Default value Description
folder_name str INBOXname of the folder to select
param folder_name:
 name of the folder to select
return:message count in the selected folder

Returns number of messages in the folder or exception if folder does not exist on the server.

Examples

*** Tasks ***
Select Folder   subfolder

Send Message

Send SMTP email

Arguments

Argument Type Default value Description
sender strwho is sending, ie. 'from'
recipients strwho is receiving, ie. 'to'
subject str mail subject field
body str mail body content
attachments str Nonelist of filepaths to attach, defaults to []
html bool Falseif message content is in HTML, default False
images str Nonelist of filepaths for inline use, defaults to []
param sender:who is sending, ie. 'from'
param recipients:
 who is receiving, ie. 'to'
param subject:mail subject field
param body:mail body content
param attachments:
 list of filepaths to attach, defaults to []
param html:if message content is in HTML, default False
param images:list of filepaths for inline use, defaults to []

Valid sender values:

Examples

*** Tasks ***
Send Message  sender@domain.com  recipient@domain.com
...           subject=Greetings Software Robot Developer
...           body=${email_body}
...           attachments:${CURDIR}${/}report.pdf

Send Smtp Hello

Send hello message to SMTP server.

Required step when creating SMTP connection.

Set Credentials

Set credentials

Arguments

Argument Type Default value Description
account str Noneuser account as string, defaults to None
password str Noneuser password as string, defaults to None
param account:user account as string, defaults to None
param password:user password as string, defaults to None

Examples

*** Tasks ***
Set Credentials   ${username}   ${password}
Authorize

Unflag Messages

Mark messages as not flagged

Arguments

Argument Type Default value Description
criterion str Nonemark messages matching criterion
param criterion:
 mark messages matching criterion
return:successful operations (int), matching messages (int)

Examples

*** Tasks ***
${unflagged}  ${oftotal}  Unflag Messages   SUBJECT rpa

Wait For Message

Wait for email matching criterion to arrive into mailbox.

Arguments

Argument Type Default value Description
criterion str message filter to wait for, defaults to ""
timeout float 5.0total time in seconds to wait for email, defaults to 5.0
interval float 1.0time in seconds for new check, defaults to 1.0
param criterion:
 message filter to wait for, defaults to ""
param timeout:total time in seconds to wait for email, defaults to 5.0
param interval:time in seconds for new check, defaults to 1.0
return:list of messages or False

Examples

*** Tasks ***
@{emails}  Wait For Message  SUBJECT "rpa task"  timeout=300  interval=10