ConsoleUser
Copyright (c) 2010-2023 Skaion Corporarion, www.skaion.com
This project was developed in part by numerous sponsorships from the U.S. Government. The U.S. Government is authorized to reproduce and distribute reprints of Governmental purposes notwithstanding any copyright notation thereon.
All content reflects those of the authors and should not be interpreted as necessarily representing the official policies or endorsements, either expressed or implied, of the U.S. Government or Skaion Corporation.
- class EmailClient.EmailClient(system, config, etype=None)¶
This class is the public interface by which a <no title> can access and manage email. This class abstracts away the actual software that is being used to access the email, so that can be changed without needing to change the <no title> as long as there are no changes to this interface.
Parameters:
system: a <no title> object to communicate with the target system
config: a <no title> object holding all our configuration
etype: optionally the (string) name of the type of client to create, overriding anything in the config object
- compose_new(to, subject, msg, cc='', attach=())¶
Compose a new mail message with the given fields filled in.
Parameters:
to: the string recipient(s) in the TO: field
subject: the string to enter as the subject field
msg: the message to type in the body of the message
cc: optionally the string to type in the CC: field
attach: optionally a list of paths to files to attach to the message
- delete()¶
Delete the currently selected message.
- forward(to, cc='', msg='', attach=(), subject='')¶
Forward the currently selected message to at least one recipient optionally with an additional message added to the email.
Parameters:
to: the string to enter in the TO: field
cc: optionally the string to enter in the CC: field
msg: optionally the string to add to the body before sending
attach: optionally a list of paths to files to attach to the message
subject: option new subject to use instead of the default
- get_message_count()¶
Return: the number of messages in the currently selected folder
- has_attachments()¶
Return: whether or not there are attachments on the currently selected message
- has_links()¶
Check if there are any links visisble (may not scroll the message) and return a list of tuples of coordinates of the upper left and lower right corners of the visisble links.
Return: a list of rectangles surounding visible links
- open_attachment(attachment)¶
Open an attachment without explictly saving it.
Parameters:
attachment: the string which will identify the attachment to open
- read()¶
Read the currently selected message, this may involve opening the message in a new window (and closing it when done) or scrolling a viewing area, or seeming to be idle for a while.
- reply(msg, to='', cc='', attach=(), subject='')¶
Reply to the currently selected message, optionally responding to additional recipients.
Parameters:
msg: the (string) message to type as the reply
to: optionally a string to add to the TO: field
cc: optionally a string to add to the CC: field
attach: optionally a list of paths to files to attach to the message
subject: option new subject to use instead of the default
- reply_all(msg, attach=(), subject='')¶
Press the reply-to-all button (or similar) and add a message.
Parameters:
msg: the string message to type
attach`: optionally a list of paths to files to attach to the message
subject: option new subject to use instead of the default
- save_attachments(directory)¶
Save the attachments on the current message to the given directory.
Parameters:
directory: the directory in which the attachments should be saved
- select_folder(title)¶
Select the first folder that is found that matches the given title.
Parameters:
title: the title of the mail Folder to select
- select_message_by_ind(ind)¶
Select the ind’th element in the current folder. Other messages may or may not be temporarily selected on the way to find the desired message.
Parameters:
ind: the integer index (from 0) of the message to select
- select_message_by_sender(sender)¶
Find a message in the current folder with the given sender string in the From field (which may not always be completely visible), and select it (usually by single clicking on it).
Parameters:
sender: the string to match in the From field of an email
Return: True if such a message was found and selected, False otherwise
- select_message_by_subject(subject)¶
Find a message in the current folder with the given subject and select it (usually by single clicking on it).
Parameters:
subject: the string to match as the subject of an email
Return: True if such a message was found and selected, False otherwise
- select_random_message()¶
Pick any message and select it. Clients may prefer unread messages to already read ones, but that is not required.