You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Rohit (JIRA)" <ji...@apache.org> on 2009/05/25 11:40:50 UTC

[jira] Created: (CAMEL-1645) Can't set the outgoing mail's content-type and charset

Can't set the outgoing mail's content-type and charset
------------------------------------------------------

                 Key: CAMEL-1645
                 URL: https://issues.apache.org/activemq/browse/CAMEL-1645
             Project: Apache Camel
          Issue Type: Bug
          Components: camel-mail
    Affects Versions: 2.0-M1
            Reporter: Rohit


The document at http://camel.apache.org/mail.html suggests that contentType header should set the Content-Type of the out going mail, but that doesn't work.

I am trying to set the content type of the mail I send using the contentType header. That doesn't work, but it works if I put the contentType in the endpoint uri. i.e. - 

            <camel:setHeader headerName="contentType"> 
                <camel:constant>text/html</camel:constant> 
            </camel:setHeader> 

Has no effect, while this works - 
             smtp://rohitr@xyzab.pramati.com?password=3pleRipple&contentType=text/html 

But I am not able to set the charset and it always takes us-ascii 

So for the mail the content type header comes as - 
Content-Type: text/html; charset=us-ascii

I tried using 
            <camel:setHeader headerName="contentType"> 
                <camel:constant>text/html;charset=UTF-8</camel:constant> 
            </camel:setHeader> 

and also 

            <camel:setHeader headerName="content-type"> 
                <camel:constant>text/html;charset=UTF-8</camel:constant> 
            </camel:setHeader> 

and 
smtp://rohitr@xyzab.pramati.com?password=3pleRipple&contentType=text/html;charset=UTF-8 

but nothing works

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1645) Can't set the outgoing mail's content-type and charset

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1645?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52193#action_52193 ] 

Claus Ibsen commented on CAMEL-1645:
------------------------------------

trunk: 783632.
1.x : 783638.

I did a fix on 1.x that did not involve API changes. In 2.0 I did cleanup the API a bit.

Rohit can you test it?

> Can't set the outgoing mail's content-type and charset
> ------------------------------------------------------
>
>                 Key: CAMEL-1645
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1645
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mail
>    Affects Versions: 1.6.0, 2.0-M1, 1.6.1
>            Reporter: Rohit
>            Assignee: Claus Ibsen
>             Fix For: 1.6.2, 2.0.0
>
>
> The document at http://camel.apache.org/mail.html suggests that contentType header should set the Content-Type of the out going mail, but that doesn't work.
> I am trying to set the content type of the mail I send using the contentType header. That doesn't work, but it works if I put the contentType in the endpoint uri. i.e. - 
>             <camel:setHeader headerName="contentType"> 
>                 <camel:constant>text/html</camel:constant> 
>             </camel:setHeader> 
> Has no effect, while this works - 
>              smtp://rohitr@xyzab.pramati.com?password=32478hds78&contentType=text/html 
> But I am not able to set the charset and it always takes us-ascii 
> So for the mail the content type header comes as - 
> Content-Type: text/html; charset=us-ascii
> I tried using 
>             <camel:setHeader headerName="contentType"> 
>                 <camel:constant>text/html;charset=UTF-8</camel:constant> 
>             </camel:setHeader> 
> and also 
>             <camel:setHeader headerName="content-type"> 
>                 <camel:constant>text/html;charset=UTF-8</camel:constant> 
>             </camel:setHeader> 
> and 
> smtp://rohitr@xyzab.pramati.com?password= 32478hds78&contentType=text/html;charset=UTF-8 
> but nothing works

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Reopened: (CAMEL-1645) Can't set the outgoing mail's content-type and charset

Posted by "Rohit (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-1645?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rohit reopened CAMEL-1645:
--------------------------


The change works only in case of non multipart message i.e. message without alternative message body and without attachments, but in case of multipart messages the following code is executed -

protected void addBodyToMultipart(org.apache.camel.Message camelMessage, MailConfiguration configuration, MimeMultipart activeMultipart) throws MessagingException {
        BodyPart bodyMessage = new MimeBodyPart();
        bodyMessage.setContent(camelMessage.getBody(String.class), configuration.getContentType());
        activeMultipart.addBodyPart(bodyMessage);
 }

which takes contentType from configuration and doesn't respect the header passed.

We should use the contentType header value if passed to set the contentType and fall back to configuration.getContentType only if required.

Will that take care of applying the charset to the body, if the contentType header is defined as - text/html; charset=UTF-8?

> Can't set the outgoing mail's content-type and charset
> ------------------------------------------------------
>
>                 Key: CAMEL-1645
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1645
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mail
>    Affects Versions: 1.6.0, 2.0-M1, 1.6.1
>            Reporter: Rohit
>            Assignee: Claus Ibsen
>             Fix For: 1.6.2, 2.0.0
>
>
> The document at http://camel.apache.org/mail.html suggests that contentType header should set the Content-Type of the out going mail, but that doesn't work.
> I am trying to set the content type of the mail I send using the contentType header. That doesn't work, but it works if I put the contentType in the endpoint uri. i.e. - 
>             <camel:setHeader headerName="contentType"> 
>                 <camel:constant>text/html</camel:constant> 
>             </camel:setHeader> 
> Has no effect, while this works - 
>              smtp://rohitr@xyzab.pramati.com?password=32478hds78&contentType=text/html 
> But I am not able to set the charset and it always takes us-ascii 
> So for the mail the content type header comes as - 
> Content-Type: text/html; charset=us-ascii
> I tried using 
>             <camel:setHeader headerName="contentType"> 
>                 <camel:constant>text/html;charset=UTF-8</camel:constant> 
>             </camel:setHeader> 
> and also 
>             <camel:setHeader headerName="content-type"> 
>                 <camel:constant>text/html;charset=UTF-8</camel:constant> 
>             </camel:setHeader> 
> and 
> smtp://rohitr@xyzab.pramati.com?password= 32478hds78&contentType=text/html;charset=UTF-8 
> but nothing works

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1645) Can't set the outgoing mail's content-type and charset

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1645?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52177#action_52177 ] 

Claus Ibsen commented on CAMEL-1645:
------------------------------------

Rohit thanks for reporting.

Arrrrggghh why is that every API that SUN does it terrible low level and a pain to work with.

Yeah I have to a bit of refator to let the I put the content on this part of the mime message being able to detect content type and set it correctly as either text or content and handle the charset as well :) 

> Can't set the outgoing mail's content-type and charset
> ------------------------------------------------------
>
>                 Key: CAMEL-1645
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1645
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mail
>    Affects Versions: 1.6.0, 2.0-M1, 1.6.1
>            Reporter: Rohit
>            Assignee: Claus Ibsen
>             Fix For: 1.6.2, 2.0.0
>
>
> The document at http://camel.apache.org/mail.html suggests that contentType header should set the Content-Type of the out going mail, but that doesn't work.
> I am trying to set the content type of the mail I send using the contentType header. That doesn't work, but it works if I put the contentType in the endpoint uri. i.e. - 
>             <camel:setHeader headerName="contentType"> 
>                 <camel:constant>text/html</camel:constant> 
>             </camel:setHeader> 
> Has no effect, while this works - 
>              smtp://rohitr@xyzab.pramati.com?password=32478hds78&contentType=text/html 
> But I am not able to set the charset and it always takes us-ascii 
> So for the mail the content type header comes as - 
> Content-Type: text/html; charset=us-ascii
> I tried using 
>             <camel:setHeader headerName="contentType"> 
>                 <camel:constant>text/html;charset=UTF-8</camel:constant> 
>             </camel:setHeader> 
> and also 
>             <camel:setHeader headerName="content-type"> 
>                 <camel:constant>text/html;charset=UTF-8</camel:constant> 
>             </camel:setHeader> 
> and 
> smtp://rohitr@xyzab.pramati.com?password= 32478hds78&contentType=text/html;charset=UTF-8 
> but nothing works

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (CAMEL-1645) Can't set the outgoing mail's content-type and charset

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-1645?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen reassigned CAMEL-1645:
----------------------------------

    Assignee: Claus Ibsen

> Can't set the outgoing mail's content-type and charset
> ------------------------------------------------------
>
>                 Key: CAMEL-1645
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1645
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mail
>    Affects Versions: 2.0-M1
>            Reporter: Rohit
>            Assignee: Claus Ibsen
>
> The document at http://camel.apache.org/mail.html suggests that contentType header should set the Content-Type of the out going mail, but that doesn't work.
> I am trying to set the content type of the mail I send using the contentType header. That doesn't work, but it works if I put the contentType in the endpoint uri. i.e. - 
>             <camel:setHeader headerName="contentType"> 
>                 <camel:constant>text/html</camel:constant> 
>             </camel:setHeader> 
> Has no effect, while this works - 
>              smtp://rohitr@xyzab.pramati.com?password=3pleRipple&contentType=text/html 
> But I am not able to set the charset and it always takes us-ascii 
> So for the mail the content type header comes as - 
> Content-Type: text/html; charset=us-ascii
> I tried using 
>             <camel:setHeader headerName="contentType"> 
>                 <camel:constant>text/html;charset=UTF-8</camel:constant> 
>             </camel:setHeader> 
> and also 
>             <camel:setHeader headerName="content-type"> 
>                 <camel:constant>text/html;charset=UTF-8</camel:constant> 
>             </camel:setHeader> 
> and 
> smtp://rohitr@xyzab.pramati.com?password=3pleRipple&contentType=text/html;charset=UTF-8 
> but nothing works

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CAMEL-1645) Can't set the outgoing mail's content-type and charset

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-1645?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-1645.
--------------------------------

    Resolution: Fixed

> Can't set the outgoing mail's content-type and charset
> ------------------------------------------------------
>
>                 Key: CAMEL-1645
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1645
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mail
>    Affects Versions: 1.6.0, 2.0-M1, 1.6.1
>            Reporter: Rohit
>            Assignee: Claus Ibsen
>             Fix For: 1.6.2, 2.0.0
>
>
> The document at http://camel.apache.org/mail.html suggests that contentType header should set the Content-Type of the out going mail, but that doesn't work.
> I am trying to set the content type of the mail I send using the contentType header. That doesn't work, but it works if I put the contentType in the endpoint uri. i.e. - 
>             <camel:setHeader headerName="contentType"> 
>                 <camel:constant>text/html</camel:constant> 
>             </camel:setHeader> 
> Has no effect, while this works - 
>              smtp://rohitr@xyzab.pramati.com?password=32478hds78&contentType=text/html 
> But I am not able to set the charset and it always takes us-ascii 
> So for the mail the content type header comes as - 
> Content-Type: text/html; charset=us-ascii
> I tried using 
>             <camel:setHeader headerName="contentType"> 
>                 <camel:constant>text/html;charset=UTF-8</camel:constant> 
>             </camel:setHeader> 
> and also 
>             <camel:setHeader headerName="content-type"> 
>                 <camel:constant>text/html;charset=UTF-8</camel:constant> 
>             </camel:setHeader> 
> and 
> smtp://rohitr@xyzab.pramati.com?password= 32478hds78&contentType=text/html;charset=UTF-8 
> but nothing works

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CAMEL-1645) Can't set the outgoing mail's content-type and charset

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-1645?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen updated CAMEL-1645:
-------------------------------

    Affects Version/s: 1.6.0
                       1.6.1

> Can't set the outgoing mail's content-type and charset
> ------------------------------------------------------
>
>                 Key: CAMEL-1645
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1645
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mail
>    Affects Versions: 1.6.0, 2.0-M1, 1.6.1
>            Reporter: Rohit
>            Assignee: Claus Ibsen
>             Fix For: 1.6.2, 2.0.0
>
>
> The document at http://camel.apache.org/mail.html suggests that contentType header should set the Content-Type of the out going mail, but that doesn't work.
> I am trying to set the content type of the mail I send using the contentType header. That doesn't work, but it works if I put the contentType in the endpoint uri. i.e. - 
>             <camel:setHeader headerName="contentType"> 
>                 <camel:constant>text/html</camel:constant> 
>             </camel:setHeader> 
> Has no effect, while this works - 
>              smtp://rohitr@xyzab.pramati.com?password=3pleRipple&contentType=text/html 
> But I am not able to set the charset and it always takes us-ascii 
> So for the mail the content type header comes as - 
> Content-Type: text/html; charset=us-ascii
> I tried using 
>             <camel:setHeader headerName="contentType"> 
>                 <camel:constant>text/html;charset=UTF-8</camel:constant> 
>             </camel:setHeader> 
> and also 
>             <camel:setHeader headerName="content-type"> 
>                 <camel:constant>text/html;charset=UTF-8</camel:constant> 
>             </camel:setHeader> 
> and 
> smtp://rohitr@xyzab.pramati.com?password=3pleRipple&contentType=text/html;charset=UTF-8 
> but nothing works

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CAMEL-1645) Can't set the outgoing mail's content-type and charset

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-1645?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-1645.
--------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0.0
                   1.6.2

trunk: 779143.
1.x: 779149.

> Can't set the outgoing mail's content-type and charset
> ------------------------------------------------------
>
>                 Key: CAMEL-1645
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1645
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mail
>    Affects Versions: 1.6.0, 2.0-M1, 1.6.1
>            Reporter: Rohit
>            Assignee: Claus Ibsen
>             Fix For: 1.6.2, 2.0.0
>
>
> The document at http://camel.apache.org/mail.html suggests that contentType header should set the Content-Type of the out going mail, but that doesn't work.
> I am trying to set the content type of the mail I send using the contentType header. That doesn't work, but it works if I put the contentType in the endpoint uri. i.e. - 
>             <camel:setHeader headerName="contentType"> 
>                 <camel:constant>text/html</camel:constant> 
>             </camel:setHeader> 
> Has no effect, while this works - 
>              smtp://rohitr@xyzab.pramati.com?password=3pleRipple&contentType=text/html 
> But I am not able to set the charset and it always takes us-ascii 
> So for the mail the content type header comes as - 
> Content-Type: text/html; charset=us-ascii
> I tried using 
>             <camel:setHeader headerName="contentType"> 
>                 <camel:constant>text/html;charset=UTF-8</camel:constant> 
>             </camel:setHeader> 
> and also 
>             <camel:setHeader headerName="content-type"> 
>                 <camel:constant>text/html;charset=UTF-8</camel:constant> 
>             </camel:setHeader> 
> and 
> smtp://rohitr@xyzab.pramati.com?password=3pleRipple&contentType=text/html;charset=UTF-8 
> but nothing works

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CAMEL-1645) Can't set the outgoing mail's content-type and charset

Posted by "Rohit (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-1645?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rohit updated CAMEL-1645:
-------------------------

    Description: 
The document at http://camel.apache.org/mail.html suggests that contentType header should set the Content-Type of the out going mail, but that doesn't work.

I am trying to set the content type of the mail I send using the contentType header. That doesn't work, but it works if I put the contentType in the endpoint uri. i.e. - 

            <camel:setHeader headerName="contentType"> 
                <camel:constant>text/html</camel:constant> 
            </camel:setHeader> 

Has no effect, while this works - 
             smtp://rohitr@xyzab.pramati.com?password=32478hds78&contentType=text/html 

But I am not able to set the charset and it always takes us-ascii 

So for the mail the content type header comes as - 
Content-Type: text/html; charset=us-ascii

I tried using 
            <camel:setHeader headerName="contentType"> 
                <camel:constant>text/html;charset=UTF-8</camel:constant> 
            </camel:setHeader> 

and also 

            <camel:setHeader headerName="content-type"> 
                <camel:constant>text/html;charset=UTF-8</camel:constant> 
            </camel:setHeader> 

and 
smtp://rohitr@xyzab.pramati.com?password= 32478hds78&contentType=text/html;charset=UTF-8 

but nothing works

  was:
The document at http://camel.apache.org/mail.html suggests that contentType header should set the Content-Type of the out going mail, but that doesn't work.

I am trying to set the content type of the mail I send using the contentType header. That doesn't work, but it works if I put the contentType in the endpoint uri. i.e. - 

            <camel:setHeader headerName="contentType"> 
                <camel:constant>text/html</camel:constant> 
            </camel:setHeader> 

Has no effect, while this works - 
             smtp://rohitr@xyzab.pramati.com?password=3pleRipple&contentType=text/html 

But I am not able to set the charset and it always takes us-ascii 

So for the mail the content type header comes as - 
Content-Type: text/html; charset=us-ascii

I tried using 
            <camel:setHeader headerName="contentType"> 
                <camel:constant>text/html;charset=UTF-8</camel:constant> 
            </camel:setHeader> 

and also 

            <camel:setHeader headerName="content-type"> 
                <camel:constant>text/html;charset=UTF-8</camel:constant> 
            </camel:setHeader> 

and 
smtp://rohitr@xyzab.pramati.com?password=3pleRipple&contentType=text/html;charset=UTF-8 

but nothing works


> Can't set the outgoing mail's content-type and charset
> ------------------------------------------------------
>
>                 Key: CAMEL-1645
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1645
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mail
>    Affects Versions: 1.6.0, 2.0-M1, 1.6.1
>            Reporter: Rohit
>            Assignee: Claus Ibsen
>             Fix For: 1.6.2, 2.0.0
>
>
> The document at http://camel.apache.org/mail.html suggests that contentType header should set the Content-Type of the out going mail, but that doesn't work.
> I am trying to set the content type of the mail I send using the contentType header. That doesn't work, but it works if I put the contentType in the endpoint uri. i.e. - 
>             <camel:setHeader headerName="contentType"> 
>                 <camel:constant>text/html</camel:constant> 
>             </camel:setHeader> 
> Has no effect, while this works - 
>              smtp://rohitr@xyzab.pramati.com?password=32478hds78&contentType=text/html 
> But I am not able to set the charset and it always takes us-ascii 
> So for the mail the content type header comes as - 
> Content-Type: text/html; charset=us-ascii
> I tried using 
>             <camel:setHeader headerName="contentType"> 
>                 <camel:constant>text/html;charset=UTF-8</camel:constant> 
>             </camel:setHeader> 
> and also 
>             <camel:setHeader headerName="content-type"> 
>                 <camel:constant>text/html;charset=UTF-8</camel:constant> 
>             </camel:setHeader> 
> and 
> smtp://rohitr@xyzab.pramati.com?password= 32478hds78&contentType=text/html;charset=UTF-8 
> but nothing works

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.