You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by rohitbrai <ro...@gmail.com> on 2009/05/21 12:51:36 UTC
Can Modify Mail/SMTP component to accept Sender Name along with
Sender Email
I have a requirement, which should I think should be standard, that when I
send the mail I should be able to set the sender name also along with the
sender email.
Is there any way to do this??? Can I extend the MailBinding class, such that
Camel reads my class to create binding for the the mail component?
I am asking because I may need to do many customizations to the mail and
headers and properties before sending the mail in my application.
Regards,
Rohit
--
View this message in context: http://www.nabble.com/Can-Modify-Mail-SMTP-component-to-accept-Sender-Name-along-with-Sender-Email-tp23651192p23651192.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Can Modify Mail/SMTP component to accept Sender Name along with
Sender Email
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
Do you mind creating a ticket in JIRA for the fromName option. That is
a good option to have in the URI.
On Thu, May 21, 2009 at 1:47 PM, rohitbrai <ro...@gmail.com> wrote:
>
> In the immediate case I need to change this -
>
>
> if (empty(mimeMessage.getFrom())) {
>
> //default the address to the endpoint destination
>
> String from = endpoint.getConfiguration().getFrom();
>
> mimeMessage.setFrom(new InternetAddress(from));
>
> }
>
>
> to
>
>
> if (empty(mimeMessage.getFrom())) {
>
> //default the address to the endpoint destination
>
> String from = endpoint.getConfiguration().getFrom();
>
> String fromName = endpoint.getConfiguration().getFromName();
>
> if(fromName != null)
>
> mimeMessage.setFrom(new InternetAddress(from, fromName));
>
> else
>
> mimeMessage.setFrom(new InternetAddress(from));
>
> }
>
>
>
>
>
> rohitbrai wrote:
>>
>> I have a requirement, which should I think should be standard, that when I
>> send the mail I should be able to set the sender name also along with the
>> sender email.
>>
>> Is there any way to do this??? Can I extend the MailBinding class, such
>> that Camel reads my class to create binding for the the mail component?
>>
>> I am asking because I may need to do many customizations to the mail and
>> headers and properties before sending the mail in my application.
>>
>> Regards,
>> Rohit
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Can-Modify-Mail-SMTP-component-to-accept-Sender-Name-along-with-Sender-Email-tp23651192p23651866.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Claus Ibsen
Apache Camel Committer
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Re: Can Modify Mail/SMTP component to accept Sender Name along with
Sender Email
Posted by rohitbrai <ro...@gmail.com>.
In the immediate case I need to change this -
if (empty(mimeMessage.getFrom())) {
//default the address to the endpoint destination
String from = endpoint.getConfiguration().getFrom();
mimeMessage.setFrom(new InternetAddress(from));
}
to
if (empty(mimeMessage.getFrom())) {
//default the address to the endpoint destination
String from = endpoint.getConfiguration().getFrom();
String fromName = endpoint.getConfiguration().getFromName();
if(fromName != null)
mimeMessage.setFrom(new InternetAddress(from, fromName));
else
mimeMessage.setFrom(new InternetAddress(from));
}
rohitbrai wrote:
>
> I have a requirement, which should I think should be standard, that when I
> send the mail I should be able to set the sender name also along with the
> sender email.
>
> Is there any way to do this??? Can I extend the MailBinding class, such
> that Camel reads my class to create binding for the the mail component?
>
> I am asking because I may need to do many customizations to the mail and
> headers and properties before sending the mail in my application.
>
> Regards,
> Rohit
>
>
>
--
View this message in context: http://www.nabble.com/Can-Modify-Mail-SMTP-component-to-accept-Sender-Name-along-with-Sender-Email-tp23651192p23651866.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Can Modify Mail/SMTP component to accept Sender Name along with
Sender Email
Posted by rohitbrai <ro...@gmail.com>.
Thats cool!
Never thought about it :-| After all the endpoints are just POJOs. So this
will be applicable to any component!!! This should b put in a writeup
somewhere, very obvious, but can overlook easily...
Will try to write a quick post on this on the weekend.
Regards,
Rohit
willem.jiang wrote:
>
> Hi,
>
> You can set the your mail binding form the mail endpoint.
> Here is some examples.
> Java DSL
>
> MailEndpoint mailEndpoint = new MailEndpoint("MailURI");
> mailEndpoint.setBinding(new YourBinding());
>
> from(mailEndpoint).to("other endpoint");
>
> Spring
>
> <bean name="myBinding" class="MyBinding"/>
>
> <bean name="mailEndpoint"
> class="org.apache.camel.component.mail.MailEndpoint">
> <property name="binding" ref="myBinding"/>
> </bean>
> <camelContext id="camel"
> xmlns="http://activemq.apache.org/camel/schema/spring">
> <route>
> <from ref="mailEndpoint"/>
> <to uri="otherEndpoint"/>
> </route>
> </camelContext>
>
>
> Willem
>
> rohitbrai wrote:
>> Found a workaround, which satisfies the requirement -
>> setHeader("from", constant("Dummy <du...@dumdum.com>"))
>>
>> Where Dummy is the sender name and dummy@dumdum.com is the sender email.
>>
>>
>>
>> rohitbrai wrote:
>>> I have a requirement, which should I think should be standard, that when
>>> I
>>> send the mail I should be able to set the sender name also along with
>>> the
>>> sender email.
>>>
>>> Is there any way to do this??? Can I extend the MailBinding class, such
>>> that Camel reads my class to create binding for the the mail component?
>>>
>>> I am asking because I may need to do many customizations to the mail and
>>> headers and properties before sending the mail in my application.
>>>
>>> Regards,
>>> Rohit
>>>
>>>
>>>
>>
>
>
>
--
View this message in context: http://www.nabble.com/Can-Modify-Mail-SMTP-component-to-accept-Sender-Name-along-with-Sender-Email-tp23651192p23664324.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Can Modify Mail/SMTP component to accept Sender Name along with
Sender Email
Posted by Willem Jiang <wi...@gmail.com>.
Hi,
You can set the your mail binding form the mail endpoint.
Here is some examples.
Java DSL
MailEndpoint mailEndpoint = new MailEndpoint("MailURI");
mailEndpoint.setBinding(new YourBinding());
from(mailEndpoint).to("other endpoint");
Spring
<bean name="myBinding" class="MyBinding"/>
<bean name="mailEndpoint"
class="org.apache.camel.component.mail.MailEndpoint">
<property name="binding" ref="myBinding"/>
</bean>
<camelContext id="camel"
xmlns="http://activemq.apache.org/camel/schema/spring">
<route>
<from ref="mailEndpoint"/>
<to uri="otherEndpoint"/>
</route>
</camelContext>
Willem
rohitbrai wrote:
> Found a workaround, which satisfies the requirement -
> setHeader("from", constant("Dummy <du...@dumdum.com>"))
>
> Where Dummy is the sender name and dummy@dumdum.com is the sender email.
>
>
>
> rohitbrai wrote:
>> I have a requirement, which should I think should be standard, that when I
>> send the mail I should be able to set the sender name also along with the
>> sender email.
>>
>> Is there any way to do this??? Can I extend the MailBinding class, such
>> that Camel reads my class to create binding for the the mail component?
>>
>> I am asking because I may need to do many customizations to the mail and
>> headers and properties before sending the mail in my application.
>>
>> Regards,
>> Rohit
>>
>>
>>
>
Re: Can Modify Mail/SMTP component to accept Sender Name along with
Sender Email
Posted by rohitbrai <ro...@gmail.com>.
Found a workaround, which satisfies the requirement -
setHeader("from", constant("Dummy <du...@dumdum.com>"))
Where Dummy is the sender name and dummy@dumdum.com is the sender email.
rohitbrai wrote:
>
> I have a requirement, which should I think should be standard, that when I
> send the mail I should be able to set the sender name also along with the
> sender email.
>
> Is there any way to do this??? Can I extend the MailBinding class, such
> that Camel reads my class to create binding for the the mail component?
>
> I am asking because I may need to do many customizations to the mail and
> headers and properties before sending the mail in my application.
>
> Regards,
> Rohit
>
>
>
--
View this message in context: http://www.nabble.com/Can-Modify-Mail-SMTP-component-to-accept-Sender-Name-along-with-Sender-Email-tp23651192p23652052.html
Sent from the Camel - Users mailing list archive at Nabble.com.