Use send task to Send Email and not wait to finish sending

Hello everyone,

I want to send email to customer in BPM flow.
I now using Send Task and use Implementation - External to send TOPIC to external application. That application will send the email to customer via email server.

I want my process to be finished and do not care about send email result of external application. But now the process stop at Send task block (wait for external application to send back finish signal).

Could you tell me a way to do that. Thanks in advanced!

Hi @thangnch,

You can implement your send mail logic in a separate process with a message start event.

Whenever there is a need to send an email, simply use a throw message to trigger the send email process and immediately continue the execution following the throw message.

Hi @thangnch,

throw message can have Expression implementation with an expression similar to below
#{execution.getProcessEngineServices().getRuntimeService().createMessageCorrelation("do_send_mail_msg").setVariable("from", "<FROM>").setVariable("to", "<TO>").startMessageOnly().correlate()}

Thanks a lot hassang, I will try your method.

Thank you very much. It worked!
Ah btw, could you tell me the link where i can learn above code.
Thank you! @hassang

1 Like

Hi @thangnch,

Kindly find below Java docs for createMessageCorrelation method and MessageCorrelationBuilder

https://docs.camunda.org/javadoc/camunda-bpm-platform/7.16/org/camunda/bpm/engine/RuntimeService.html#createMessageCorrelation(java.lang.String)

https://docs.camunda.org/javadoc/camunda-bpm-platform/7.16/org/camunda/bpm/engine/runtime/MessageCorrelationBuilder.html

Great! Thanks a lot @hassang