All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.spring.email-sender.xml Maven / Gradle / Ivy

Go to download

A application used as an example on how to set up pushing its components to the Central Repository.

There is a newer version: 1.0.13.RELEASE
Show newest version
<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (c) 2015 the original author or authors
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~ 	http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<beans:beans xmlns="http://www.springframework.org/schema/integration"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xmlns:beans="http://www.springframework.org/schema/beans"
             xmlns:int-mail="http://www.springframework.org/schema/integration/mail"
             xmlns:context="http://www.springframework.org/schema/context"
             xsi:schemaLocation="http://www.springframework.org/schema/beans
                  http://www.springframework.org/schema/beans/spring-beans.xsd
                  http://www.springframework.org/schema/integration
                  http://www.springframework.org/schema/integration/spring-integration.xsd   http://www.springframework.org/schema/integration/mail http://www.springframework.org/schema/integration/mail/spring-integration-mail.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">

    <context:property-placeholder location="classpath*:config/*.properties"/>

    <beans:bean id="emailService" class="com.clusterra.email.sender.EmailSenderImpl">
        <beans:property name="fromEmail" value="${clusterra.email-sender.from}"/>
    </beans:bean>

    <publish-subscribe-channel id="emailInboundChannel"/>

    <gateway id="emailGateway" service-interface="com.clusterra.email.infrastructure.EmailGateway">
        <method name="send" request-channel="emailInboundChannel" request-timeout="5000"/>
    </gateway>


    <logging-channel-adapter id="emailInboundChannelLogger"
                             channel="emailInboundChannel"
                             expression="'EMAIL sending to: ' + headers.mail_to + ', from: ' + headers.mail_from + ', subject: ' + headers.mail_subject"/>


    <channel id="emailOutboundChannel">
        <queue/>
    </channel>

    <poller default="true" id="emailOutboundChannelPoller" time-unit="MILLISECONDS" fixed-delay="100"/>


    <beans:bean id="javaMailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
        <beans:property name="host" value="${spring.mail.host}"/>
        <beans:property name="port" value="${spring.mail.port}"/>
        <beans:property name="protocol" value="smtps"/>
        <beans:property name="username" value="${spring.mail.username}"/>
        <beans:property name="password" value="${spring.mail.password}"/>
        <beans:property name="defaultEncoding" value="${spring.mail.default-encoding}"/>
        <beans:property name="javaMailProperties">
            <beans:props>
                <beans:prop key="mail.smtps.auth">true</beans:prop>
                <beans:prop key="mail.smtp.ssl.enable">true</beans:prop>
                <beans:prop key="mail.transport.protocol">smtps</beans:prop>
            </beans:props>
        </beans:property>
    </beans:bean>

    <int-mail:outbound-channel-adapter channel="emailOutboundChannel" mail-sender="javaMailSender"/>

    <beans:bean id="mimeMessageTransformer" class="com.clusterra.email.infrastructure.MimeMessageTransformer"/>

    <chain input-channel="emailInboundChannel" output-channel="emailOutboundChannel">
        <transformer ref="mimeMessageTransformer"/>
    </chain>

</beans:beans>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy