How does camunda-bpmn-mail-master works?

I have desided to use this github repo for sending mail via smtp.gmail.com to my mail account i have configured this mail configurations
https://github.com/camunda/camunda-bpm-mail/blob/master/extension/core/configs/gmail.properties
mail.transport.protocol=smtp
mail.smtp.host=smtp.gmail.com
mail.smtp.port=465
mail.smtp.auth=true
mail.smtp.ssl.enable=true
mail.smtp.socketFactory.port=465
mail.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory

mail.store.protocol=imaps
mail.imaps.host=imap.gmail.com
mail.imaps.port=993
mail.imaps.timeout=10000

# disable partial fetching or increase the fetch size for large attachments
mail.imap.partialfetch=false

mail.poll.folder=INBOX

mail.sender=MyMail@gmail.com
mail.sender.alias=My Name

mail.attachment.download=true
mail.attachment.path=attachments

mail.user=Umymail@gmail.com
mail.password=MyPASSWORD

than i have used this command mvn clean install and than i have placed this jar file :camunda-bpm-mail-core-1.3.0-SNAPSHOT.jar into cmaunda server tomcat/lib and i have also added camunda-bpm-mail.example.pizza-1.3.0-SNAPSHOT.war this war in webapp but whne the war is deployed and i start the task it is failed and throws this exception:
Mail poll can’t find mail configuration in classpath, what should i configure to make this task work properly?
also i want to know if it is possible to use this camunda-bpm-mail-core-1.3.0-SNAPSHOT.jar for sendning mail in another bpmn process( is it possible to use this process in general like service for sending mail in other processes?)

Hi @Sally,

did you add the configuration file to the tomcat lib folder and set the environment variable as described? Please see the instructions.

You can use the extension to send mails to a mail server and poll mails from a mail server. You can do this from different processes. But you can’t send a mail directly to another process. You communicate always over the mail server. So it’s maybe not suitable for inter-process communication.

Best regards,
Philipp

Hi @Philipp_Ossler.
In that example examples/pizza/src/main/resources/mail-config.properties, i guess that we should change
mail.user=USER@gmail.com
mail.password=PASSWORD
with our ownes. The question is : how can we hide such sensitives information while in a team, others can look at this file?

@leetong do you want to secure the mail-config.properties?

@aravindhrs, If i understood well the example, we can create a .WAR and deploy the example on a Tomcat server. We also need to modify the mail.config.properties with email details (email, user, password). That file will stay into the WEB-INF/Classes directory.
Let assume that we are several into an organization, and let assume that we are all allowed to use the example.
How could we set it up as a way that we all have our email used?
another point i did not get for now is: if i send an email with a browser, how the example can work? Does the setup proposed can catch the signal from my email server and start the process? if so, if we are several to use the example, how can we split by owner?
best regards

you have to configure the email id & password in these fields:

mail.user=USER@gmail.com
mail.password=PASSWORD

This can be achieved by PollMailConnector from the connector like below:

MailService mailService = MailServiceFactory.getService(getConfiguration());
Folder folder = mailService.ensureOpenFolder(request.getFolder());
PollMailInvocation invocation = new PollMailInvocation(folder, request, requestInterceptors, mailService);
List<Message> messages = (List<Message>) invocation.proceed();
response = PollMailResponse(messages, mailService, request.downloadAttachments(), getConfiguration().getAttachmentPath());

To poll the messages from mail server, set the below config:

mail.store.protocol=imaps
mail.imaps.host=imap.gmail.com
mail.imaps.port=993
mail.imaps.timeout=10000
mail.poll.folder=INBOX
mail.sender=USER@google.com
mail.sender.alias=User Inc

this is not supported yet.

@aravindhrs, thank you very much for your answer. I will try to implement as suggested.
Last thing i’m quite confused about.
if my email is leetong @ gmail. com, do i need to replace USER@gmail.com with my email?
I guess, yes. Same for password.
So the first question still unclear: How can i hide such information?
in addition, that implies that the example can be used only by 1 person since we can configure only 1 address. How can we allow every user in an organization to use the example then?

Yes you have to replace.

1 Like

its supposed to be business email. business emails are like group emails, under this multiple users can be configured. Think of the organizational group emails & which will have alias name too.

1 Like

PropertiesMailConfiguration.java has below properties:

public static final String PROPERTIES_CLASSPATH_PREFIX = "classpath:";
public static final String DEFAULT_PROPERTIES_PATH = PROPERTIES_CLASSPATH_PREFIX + "/mail-config.properties";

Either you can override them and configure custom path or else you can override the below function from the PropertiesMailConfiguration class to read it from cloud storage like AWS S3 or HashiCorp Vault or Zookeeper config sever, etc.

protected InputStream getProperiesAsStream(String path) throws FileNotFoundException {
  //implementation to get email configurations
}

@aravindhrs, thank you so much for your expertise.
Quite desperate to see how much i need to learn :frowning: