camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject [1/3] git commit: CAMEL-7105 Added ability to send html emails
Date Mon, 06 Jan 2014 09:25:24 GMT
Updated Branches:
  refs/heads/camel-2.12.x 4293f0631 -> 3c6f56430


CAMEL-7105 Added ability to send html emails


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/67f554a3
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/67f554a3
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/67f554a3

Branch: refs/heads/camel-2.12.x
Commit: 67f554a38705cfbb201439af557a326dccb9b853
Parents: a5fd429
Author: Willem Jiang <willem.jiang@gmail.com>
Authored: Mon Jan 6 17:13:00 2014 +0800
Committer: Willem Jiang <willem.jiang@gmail.com>
Committed: Mon Jan 6 17:25:02 2014 +0800

----------------------------------------------------------------------
 .../org/apache/camel/component/aws/ses/SesConstants.java     | 1 +
 .../java/org/apache/camel/component/aws/ses/SesProducer.java | 8 +++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/67f554a3/components/camel-aws/src/main/java/org/apache/camel/component/aws/ses/SesConstants.java
----------------------------------------------------------------------
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ses/SesConstants.java
b/components/camel-aws/src/main/java/org/apache/camel/component/aws/ses/SesConstants.java
index 4ff3f86..b301364 100644
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ses/SesConstants.java
+++ b/components/camel-aws/src/main/java/org/apache/camel/component/aws/ses/SesConstants.java
@@ -27,4 +27,5 @@ public interface SesConstants {
     String RETURN_PATH = "CamelAwsSesReturnPath";
     String SUBJECT = "CamelAwsSesSubject";
     String TO = "CamelAwsSesTo";
+    String HTML_EMAIL = "CamelAwsSesHtmlEmail";
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/67f554a3/components/camel-aws/src/main/java/org/apache/camel/component/aws/ses/SesProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ses/SesProducer.java
b/components/camel-aws/src/main/java/org/apache/camel/component/aws/ses/SesProducer.java
index 6f4919f..4ba0630 100644
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ses/SesProducer.java
+++ b/components/camel-aws/src/main/java/org/apache/camel/component/aws/ses/SesProducer.java
@@ -64,7 +64,13 @@ public class SesProducer extends DefaultProducer {
 
     private com.amazonaws.services.simpleemail.model.Message createMessage(Exchange exchange)
{
         com.amazonaws.services.simpleemail.model.Message message = new com.amazonaws.services.simpleemail.model.Message();
-        message.setBody(new Body(new Content(exchange.getIn().getBody(String.class))));
+        Boolean isHtmlEmail = exchange.getIn().getHeader(SesConstants.HTML_EMAIL, Boolean.class);
+        String content = exchange.getIn().getBody(String.class);
+        if (isHtmlEmail != null && isHtmlEmail) {
+            message.setBody(new Body().withHtml(new Content().withData(content)));
+        } else {
+            message.setBody(new Body().withText(new Content().withData(content)));
+        }
         message.setSubject(new Content(determineSubject(exchange)));
         return message;
     }


Mime
View raw message