Skip to content

Commit

Permalink
feat(email-connector): rebase + correcting and managing conflict result
Browse files Browse the repository at this point in the history
  • Loading branch information
mathias-vandaele committed Nov 28, 2024
1 parent cc6f4db commit 17fe1e8
Show file tree
Hide file tree
Showing 6 changed files with 155 additions and 98 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import jakarta.mail.MessagingException;
import jakarta.mail.Multipart;
import jakarta.mail.internet.MimeBodyPart;
import jakarta.mail.Multipart;
import jakarta.mail.internet.MimeMessage;
import java.io.File;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -678,14 +678,14 @@
"tooltip" : "Email's Html content",
"type" : "Text"
}, {
"id" : "attachmentSmtp",
"id" : "attachmentsSmtp",
"label" : "Attachment",
"description" : "Email's attachment",
"description" : "Email's attachment. e.g., =[ document1, document2]",
"optional" : true,
"feel" : "required",
"group" : "sendEmailSmtp",
"binding" : {
"name" : "data.smtpAction.attachment",
"name" : "data.smtpAction.attachments",
"type" : "zeebe:input"
},
"condition" : {
Expand All @@ -699,6 +699,7 @@
"type" : "simple"
} ]
},
"tooltip" : "Email's attachments, should be set as a list ",
"type" : "String"
}, {
"id" : "pop3maxToBeRead",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -683,14 +683,14 @@
"tooltip" : "Email's Html content",
"type" : "Text"
}, {
"id" : "attachmentSmtp",
"id" : "attachmentsSmtp",
"label" : "Attachment",
"description" : "Email's attachment",
"description" : "Email's attachment. e.g., =[ document1, document2]",
"optional" : true,
"feel" : "required",
"group" : "sendEmailSmtp",
"binding" : {
"name" : "data.smtpAction.attachment",
"name" : "data.smtpAction.attachments",
"type" : "zeebe:input"
},
"condition" : {
Expand All @@ -704,6 +704,7 @@
"type" : "simple"
} ]
},
"tooltip" : "Email's attachments, should be set as a list ",
"type" : "String"
}, {
"id" : "pop3maxToBeRead",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
import jakarta.mail.*;
import jakarta.mail.internet.*;
import jakarta.mail.search.*;
import java.nio.charset.StandardCharsets;
import jakarta.mail.util.ByteArrayDataSource;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.function.Consumer;

Expand Down Expand Up @@ -271,20 +271,7 @@ private SendEmailResponse smtpSendEmail(
if (bcc.isPresent()) message.setRecipients(Message.RecipientType.BCC, bcc.get());
headers.ifPresent(stringObjectMap -> setMessageHeaders(stringObjectMap, message));
message.setSubject(smtpSendEmail.subject());
Multipart multipart = getMultipart(smtpSendEmail);
if (!Objects.isNull(smtpSendEmail.attachment())) {
BodyPart attachment = new MimeBodyPart();
DataSource dataSource =
new ByteArrayDataSource(
smtpSendEmail.attachment().asInputStream(),
smtpSendEmail.attachment().metadata().getContentType());
attachment.setDataHandler(new DataHandler(dataSource));
attachment.setFileName(smtpSendEmail.attachment().metadata().getFileName());
multipart.addBodyPart(attachment);
Multipart multipart = new MimeMultipart();
MimeBodyPart textContent = new MimeBodyPart();
textContent.setText(smtpSendEmail.body());
multipart.addBodyPart(textContent);
Multipart multipart = getMultipart(smtpSendEmail);
if (!Objects.isNull(smtpSendEmail.attachments())) {
smtpSendEmail.attachments().forEach(getDocumentConsumer(multipart));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public record SmtpSendEmail(
property = "contentType",
oneOf = {"HTML", "MULTIPART"}))
@Valid
String htmlBody
String htmlBody,
@TemplateProperty(
label = "Attachment",
group = "sendEmailSmtp",
Expand Down
Loading

0 comments on commit 17fe1e8

Please sign in to comment.