Skip to content

Commit 1042f5d

Browse files
committed
#5 added different mail addresses as args
1 parent 55d6329 commit 1042f5d

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

src/MailClientLibrary/__init__.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ class MailClientLibrary(DynamicCore):
3939
All Avialable Args:
4040
| Username | The user id, which will initially set for all protocols |
4141
| Password | The user password, which will initially set for all protocols |
42-
| MailServerAddress | The newtwork address of the mail server to be connected. currently supports only one MailServerAddress for all protocols |
42+
| MailServerAddress | The newtwork address of the mail server to be connected. |
43+
| ImapServerAddress | The newtwork address of the imap server to be connected. This replaces the MailServerAddress if given. |
44+
| Pop3ServerAddress | The newtwork address of the pop3 server to be connected. This replaces the MailServerAddress if given. |
45+
| SmtpServerAddress | The newtwork address of the smtp server to be connected. This replaces the MailServerAddress if given. |
4346
| ImapPorts | The imap communication port numbers: [<ssl>,<no ssl>] |
4447
| Pop3Ports | The pop3 communication port numbers: [<ssl>,<no ssl>] |
4548
| SmtpPorts | The smtp communication port numbers: [<ssl>,<no ssl>] |
@@ -80,11 +83,13 @@ class MailClientLibrary(DynamicCore):
8083
ROBOT_LIBRARY_SCOPE = "Global"
8184
ROBOT_LISTENER_API_VERSION = 2
8285

83-
def __init__(self, Username="user", Password="pass", MailServerAddress="127.0.0.1", ImapPorts=[993,143], Pop3Ports=[995,110], SmtpPorts=[465,25]):
86+
def __init__(self, Username="user", Password="pass", MailServerAddress="127.0.0.1",
87+
ImapPorts=[993,143], Pop3Ports=[995,110], SmtpPorts=[465,25],
88+
ImapServerAddress=None, Pop3ServerAddress=None, SmtpServerAddress=None):
8489
libraries = [
8590
ImapKeywords(),
8691
Pop3Keywords(),
8792
SmtpKeywords(),
88-
SetterKeywords(Username, Password, MailServerAddress, ImapPorts, Pop3Ports, SmtpPorts),
93+
SetterKeywords(Username, Password, MailServerAddress, ImapPorts, Pop3Ports, SmtpPorts, ImapServerAddress, Pop3ServerAddress, SmtpServerAddress),
8994
]
90-
DynamicCore.__init__(self, libraries)
95+
DynamicCore.__init__(self, libraries)

src/MailClientLibrary/keywords/setter.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22
from ..mailclient.variables import Variables
33

44
class SetterKeywords:
5-
def __init__(self,MailUsername:str, MailPassword:str, MailServerAddress:str, ImapPorts:list, Pop3Ports:list, SmtpPorts:list):
5+
def __init__(self,MailUsername:str, MailPassword:str, MailServerAddress:str, ImapPorts:list, Pop3Ports:list, SmtpPorts:list,
6+
ImapServerAddress:str=None, Pop3ServerAddress:str=None, SmtpServerAddress:str=None):
67
self.set_mail_username_and_password(MailUsername, MailPassword)
7-
self.set_mail_server_address(MailServerAddress)
8+
self.set_imap_server_address(ImapServerAddress if ImapServerAddress else MailServerAddress)
9+
self.set_pop3_server_address(Pop3ServerAddress if Pop3ServerAddress else MailServerAddress)
10+
self.set_smtp_server_address(SmtpServerAddress if SmtpServerAddress else MailServerAddress)
811
# set all initial ports
912
self.set_both_imap_ports(int(ImapPorts[0]),int(ImapPorts[1]))
1013
self.set_both_pop3_ports(int(Pop3Ports[0]),int(Pop3Ports[1]))

0 commit comments

Comments
 (0)