Skip to content
This repository was archived by the owner on Apr 5, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ public class MailSourceOptionsMetadata implements ProfileNamesProvider {

private String propertiesFile = null;

private boolean useRawMime = false;

private static final String IMAPS_PROPERTIES = "mail.imap.socketFactory.class=javax.net.ssl.SSLSocketFactory," +
"mail.imap.socketFactory.fallback=false," +
"mail.store.protocol=imaps";
Expand Down Expand Up @@ -133,6 +135,10 @@ public boolean isUsePolling() {
return usePolling;
}

public boolean isUseRawMime() {
return useRawMime;
}

@ModuleOption("comma separated JavaMail property values")
public void setProperties(String properties) {
this.properties = properties;
Expand All @@ -157,7 +163,12 @@ public String getDefaultProperties() {

@Override
public String[] profilesToActivate() {
return (usePolling) ? new String[] {"use-polling"} : new String[] {"use-idle"};
String [] profilesToActivate =
{
(useRawMime) ? "raw-mime":"body-as-string",
(usePolling) ? "use-polling":"use-idle"
};
return profilesToActivate;
}

@ModuleOption("the polling interval used for looking up messages (s)")
Expand All @@ -178,6 +189,11 @@ public void setUsePolling(boolean usePolling) {
this.usePolling = usePolling;
}

@ModuleOption("whether to pass MimeMessage as is or body of the message converted to string")
public void setUseRawMime(boolean useRawMime) {
this.useRawMime = useRawMime;
}

@AssertTrue(message = "usePolling=false is only supported with imap(s)")
private boolean isUsePollingValid() {
if (!usePolling) {
Expand Down
11 changes: 9 additions & 2 deletions modules/source/mail/config/mail.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,17 @@

<channel id="output" />

<beans:beans profile="body-as-string">
<int-mail:mail-to-string-transformer
charset="${charset}" input-channel="transform" output-channel="output" />
</beans:beans>

<int-mail:mail-to-string-transformer
charset="${charset}" input-channel="transform" output-channel="output" />

<beans:beans profile="raw-mime">
<bridge input-channel="transform" output-channel="output" />
</beans:beans>


<beans:beans profile="use-polling">
<int-mail:inbound-channel-adapter
store-uri="${protocol}://${username:}:${password:}@${host}:${port}/${folder}"
Expand Down
1 change: 1 addition & 0 deletions src/docs/asciidoc/Sources.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,7 @@ $$properties$$:: $$comma separated JavaMail property values$$ *($$String$$, no d
$$propertiesFile$$:: $$file to load the JavaMail properties$$ *($$String$$, no default)*
$$protocol$$:: $$the protocol to use to retrieve messages$$ *($$MailProtocol$$, default: `imap`, possible values: `imap,imaps,pop3,pop3s`)*
$$usePolling$$:: $$whether to use polling or not (no polling works with imap(s) only)$$ *($$boolean$$, default: `false`)*
$$useRawMime$$:: $$whether to pass MimeMessage as is or body of the message converted to string$$ *($$boolean$$, default: `false`)*
$$username$$:: $$the username to use to connect to the mail server$$ *($$String$$, no default)*
//$source.mail

Expand Down