0 votes
675 views
in Integrations by (30.6k points)

1 Answer

0 votes
by (30.6k points)

Besides the System Data Send E-Mail service (SMTP through the server's mail settings) you have:

  • Java integration with JavaMail / Jakarta Mail - full control (HTML, inline images, several attachments from the document store, OAuth2 for Office 365 / Gmail, S/MIME). A managed jar with a 40-line class; the mail session can be a WebSphere Mail session looked up by JNDI so that credentials stay out of the code.
  • A mail REST API - Microsoft Graph (POST /v1.0/users/{id}/sendMail), SendGrid, Mailgun, Amazon SES: call it with a REST external service; gives templates, tracking and no SMTP relay to manage. Common in cloud / CP4BA deployments where the pods have no SMTP relay.
  • Task notification e-mails of the platform ("new task assigned", due date) - configured, not coded: Process Admin / 100Custom.xml <task-notification> and the user's portal preferences.
  • Hand-off to the ESB / a notification service - send a JMS / Kafka message with the notification and let a central service render and send; keeps templates and opt-out rules in one place (the pattern most large organisations end up with).
  • Vendor toolkits (Dosvak, Salient and others) ship "Send Email" services that wrap JavaMail as described above, with HTML templates and attachments.
// Java integration with Jakarta Mail and a WebSphere mail session (JNDI "mail/Notifications")
Session session = (Session) new InitialContext().lookup("mail/Notifications");
MimeMessage m = new MimeMessage(session);
m.setFrom("workflow@example.com"); m.setRecipients(Message.RecipientType.TO, to); m.setSubject(subject, "UTF-8");
MimeMultipart mp = new MimeMultipart();
MimeBodyPart html = new MimeBodyPart(); html.setContent(bodyHtml, "text/html; charset=UTF-8"); mp.addBodyPart(html);
MimeBodyPart att = new MimeBodyPart(); att.setDataHandler(new DataHandler(new ByteArrayDataSource(pdfBytes, "application/pdf"))); att.setFileName("invoice.pdf"); mp.addBodyPart(att);
m.setContent(mp); Transport.send(m);

References

Related questions

0 votes
1 answer 1.7k views
0 votes
1 answer 1.4k views
0 votes
1 answer 1.0k views
0 votes
1 answer 1.8k views
0 votes
1 answer 1.3k views
0 votes
1 answer 723 views
0 votes
1 answer 2.5k views
0 votes
1 answer 611 views
0 votes
1 answer 2.1k views
asked Aug 22, 2023 by sanjay_hdi (360 points)
0 votes
1 answer 2.3k views

723 questions

807 answers

98 comments

4.9k users

Join BPM Community Discord Channel

Welcome to BPM Tips Q&A, Community wiki/forum where you can ask questions and receive answers from other IBM BPM experts and members of the community. Users with 2000 points will automatically be promoted to expert level.
Created by Dosvak LLC
Our Youtube Channel
...