Closed anh-bolt closed 1 hour ago
Hi @anh-bolt , I think there is another problem with the properties. Let's assume we have multiple mailboxes setup and lets call them dummy & callison:
Variables:
mailstore-connector:
dummy:
# [enum: pop3, pop3s, imap, imaps]
protocol: 'imap'
# Host for store connection
host: 'localhost'
# ......
properties:
mail.imaps.ssl.checkserveridentity: false
mail.imaps.ssl.trust: '*'
callison:
# [enum: pop3, pop3s, imap, imaps]
protocol: 'imaps'
# Host for store connection
host: 'mx2fb4.netcup.net'
# ......
properties:
mail.imaps.ssl.checkserveridentity: false
mail.imaps.ssl.trust: '*'
Now the openStore(String storeName)
get's passed the store name (the variables path context like mailstore-connector.dummy or mailstore-connector.callison in our sample) so that you can pick which mailbox should be handled.
public static Store openStore(String storeName) throws MessagingException {
Store store = null;
String protocol = getVar(storeName, PROTOCOL_VAR);
String host = getVar(storeName, HOST_VAR);
String portString = getVar(storeName, PORT_VAR);
String user = getVar(storeName, USER_VAR);
String password = getVar(storeName, PASSWORD_VAR);
String debugString = getVar(storeName, DEBUG_VAR);
....
But it seems the getProperties()
method isn't considering this storeName
context. So I guess it will discover all properties of mailstore-connector.dummy and mailstore-connector.callison? My expectation would be to only consider the properties that are configured for the specifc mailbox.
Additional question: what happens if I have other variables (that have no connection to mailing at all) start with properties prefix. Will these also be considered? Because I don't think they should.
Expect:
properties.setProperty(name, value);
https://github.com/axonivy-market/mailstore-connector/blob/fd6d27af0c28a703413b6e2d4d92b08ca0f27da5/mailstore-connector/src/com/axonivy/connector/mailstore/MailStoreService.java#L684-L691