Skip to content

Commit

Permalink
#241: Fixed how Outlook TO, CC and BCC are handled [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
bbottema committed Jan 8, 2020
1 parent 9e739cd commit f10508e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,10 @@ public interface OutlookMessage {

String getSubject();

String getToEmail();

String getToName();

OutlookRecipient getToRecipient();

List<OutlookRecipient> getToRecipients();

List<OutlookRecipient> getCcRecipients();

List<OutlookRecipient> getBccRecipients();

@SuppressWarnings("ElementOnlyUsedFromTestCode")
Expand Down
2 changes: 1 addition & 1 deletion modules/outlook-module/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<dependency>
<groupId>org.simplejavamail</groupId>
<artifactId>outlook-message-parser</artifactId>
<version>1.5.0</version>
<version>1.6.0</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -78,23 +78,15 @@ private static EmailFromOutlookMessage buildEmailFromOutlookMessage(

private static void copyReceiversFromOutlookMessage(@NotNull EmailPopulatingBuilder builder, @NotNull OutlookMessage outlookMessage) {
//noinspection QuestionableName
for (final OutlookRecipient to : outlookMessage.getToRecipients()) {
builder.to(to.getName(), to.getAddress());
}
for (final OutlookRecipient cc : outlookMessage.getCcRecipients()) {
builder.cc(cc.getName(), cc.getAddress());
}
for (final OutlookRecipient bcc : outlookMessage.getBccRecipients()) {
builder.bcc(bcc.getName(), bcc.getAddress());
}
// only add remaining recipients...
outerloop:
for (final OutlookRecipient to : outlookMessage.getRecipients()) {
for (final Recipient recipient : builder.getRecipients()) {
if (Objects.equals(recipient.getName(), to.getName()) &&
Objects.equals(recipient.getAddress(), to.getAddress())) {
continue outerloop;
}
}
builder.to(to.getName(), to.getAddress());
}
}

@NotNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,18 +104,8 @@ public String getSubject() {
}

@Override
public String getToEmail() {
return delegate.getToEmail();
}

@Override
public String getToName() {
return delegate.getToName();
}

@Override
public OutlookRecipient getToRecipient() {
return new OutlookRecipientProxy(delegate.getToRecipient());
public List<OutlookRecipient> getToRecipients() {
return wrapRecipients(delegate.getToRecipients());
}

@Override
Expand Down

0 comments on commit f10508e

Please sign in to comment.