Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IMAP/POP/SMTP Mail Connector #4986

Closed
phantomjinx opened this issue Mar 20, 2019 · 9 comments
Closed

IMAP/POP/SMTP Mail Connector #4986

phantomjinx opened this issue Mar 20, 2019 · 9 comments
Assignees
Labels
closed/migrated Epic Use by ZenHub, typically also for user stories zenhub/done

Comments

@phantomjinx
Copy link
Contributor

phantomjinx commented Mar 20, 2019

See also https://issues.jboss.org/browse/ENTESB-11505

As a citizen user of fuse online, I want to be able to connect to an IMAP/POP mail account to consume the messages or to an SMTP mail account to send messages.
This should be equivalent to the functionality of the GMail connector but not restricted to GMail.

DoD

  • I can connect to a generic email account, subject to the credentials normally required for receiving email in an email application, and consume the mail messages in an integration.
  • I can connect to a generic email account, subject to the credentials normally required for sending email in an email application, and deliver messages to the email account from an integration.
@pure-bot pure-bot bot added the notif/triage The issue needs triage. Applied automatically to all new issues. label Mar 20, 2019
@phantomjinx phantomjinx added the Epic Use by ZenHub, typically also for user stories label Mar 20, 2019
@phantomjinx phantomjinx self-assigned this Mar 20, 2019
@heiko-braun heiko-braun removed the notif/triage The issue needs triage. Applied automatically to all new issues. label Mar 21, 2019
@phantomjinx
Copy link
Contributor Author

Interesting little obstacle. The camel-mail component doesn't provide 1 component but 6, ie. IMAP, IMAPS, POP3, POP3S, SMTP, SMTPS. Thus, the architecture of a syndesis email component needs to be able to delegate to one of these depending on the email protocol identified by the user.

So, at the moment, I have the Connector inputs as:

  • hostname (required)
  • protocol (required 1 of those listed above)
  • port (required)
  • user (optional)
  • password (optional)
  • certificate (optional)
    These inputs validate the server by connecting to it using the camel-mail API, ie. create a MailConfiguration and apply to a JavaMailSender. For this to work, the protocol is required.

The issue comes with creating an integration and associating the created connection. The camel componentSchema in the syndesis email.json file is required and used in the ConnectionStepHandler (interesting no check for null so error little opaque). Normally, though the componentSchema is hard-coded, eg. fhir in fhir-connector, olingo4 in odata-connector, so rarely an issue. However, in this situation the componentScheme would have to be dynamic, ie. IMAP(s), POP3(s), SMTP(s). Therefore, I have to communicate the protocol of the connection to the new Integration's model in order to set the componentScheme.

My first cunning plan is to add an additional componentScheme field to SyndesisMetadata. That will get set via the email-connector's metadata retrieval and transferred (from meta -> server) as part of the DynamicActionMetadata and then applied in ConnectionActionHandler.applyMetadataTo().

An alternative could be to make a camel-email component class that acts as a proxy delegating to the real camel-mail components based on the protocol type, essentially 2 layers of proxy component. Not fleshed this out thoroughly yet and may not be a goer.

Anyway, would be interested in views on what I've come up with so far and any alternative suggestions that you may have.

Thx!

@zregvart @lburgazzoli

@zregvart
Copy link
Member

zregvart commented Apr 3, 2019

One option might be to create a Camel component within Syndesis and then in createEndpoint of the ComponentProxyComponent implementation delegate to the appropriate Camel base component.

Perhaps this needs two connectors one for sending and one for receiving e-mails, otherwise we might end up with a lot of optional properties. Would make sense to create two connections one to the SMTP server and to the mailbox server (IMAP/POP3).

@alicerum
Copy link

Hi! I'm working on test coverage of this feature in the testsuite.
Is it possible to add STARTTLS support to the email-send connector?
AFAIK some servers support STARTTLS (which is smpt wrapped in tls) and don't support smtps explicitly. My email server seems to be one of them, so I'm not able to even validate connection to it.
As far as I know it should not be a huge difficult to implement change.

@phantomjinx
Copy link
Contributor Author

@Wyvie

Hi! I'm working on test coverage of this feature in the testsuite.
Is it possible to add STARTTLS support to the email-send connector?
AFAIK some servers support STARTTLS (which is smpt wrapped in tls) and don't support smtps explicitly. My email server seems to be one of them, so I'm not able to even validate connection to it.
As far as I know it should not be a huge difficult to implement change.

Looking at the guide, there is no obvious way to implement STARTTTLS. However, looking in the source code (here), it looks like it has been implemented.
Will need to get it working at the low-level, unit test it & bubble up options to allow it in syndesis so will take it a little time. In the meantime, converting to an issue.

@alicerum
Copy link

@phantomjinx thank you! Actually, I have one more question (feature request)
is it possible to specify folder to fetch mail from for imap and pop3? we have similar behaviour for gmail connector, for which user can specify label from which to get email.
having the option to specify imap and pop3 folder to fetch email from would also be nice.
i see there's a parameter folderName in the guide which has default value of INBOX. could it help?

@phantomjinx
Copy link
Contributor Author

Going to close this now as complete. Any new issues or bugs can be logged separately.

@zregvart zregvart reopened this May 27, 2019
@zregvart
Copy link
Member

We need to keep this open until QE verifies it and closes it, moving to done.

@alicerum
Copy link

Thank you for implementing those features, @phantomjinx !
I actually have been testing it and all works fine.
But, I've just found out that pop3 protocol can't work with folders other than usual ones, like Inbox, Sent and such.
Is it possible to remove Folder parameter just for the pop3 protocol of email receiving connector, and let it be there for the imap?

@heiko-braun
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed/migrated Epic Use by ZenHub, typically also for user stories zenhub/done
Projects
None yet
Development

No branches or pull requests

4 participants