这是我们用到这块时的处理:我们是单独设置了一个mail.xml内容如下: <?xml version="1.0" encoding="UTF-8"?> <querybuilder> <!-- baseDir is base directory for data files in BI application. Its value should be relative to bi.war --> <baseDir></baseDir> <as_type>WEBSPHERE</as_type> <as_url>iiop://localhost:2809/</as_url> <as_default_datasource>ViadorRepository</as_default_datasource> <authentication>false</authentication> <public_user>VIADOR_PUBLIC</public_user> <mail_smtp>mail.*.com</mail_smtp> <mail_from>**.li@*.com</mail_from> <mail_auth>true</mail_auth> <mail_user>**.li</mail_user> <mail_password>123456</mail_password> <mail_contenttype>text/plain</mail_contenttype> <mail_zipattatched>true</mail_zipattatched> </querybuilder> 这个文件我直接放到了web-inf下了 需要设计一个分析xml的类,取出值
<?xml version="1.0" encoding="UTF-8"?>
<querybuilder>
<!-- baseDir is base directory for data files in BI application. Its value should be relative to bi.war -->
<baseDir></baseDir>
<as_type>WEBSPHERE</as_type>
<as_url>iiop://localhost:2809/</as_url>
<as_default_datasource>ViadorRepository</as_default_datasource>
<authentication>false</authentication>
<public_user>VIADOR_PUBLIC</public_user>
<mail_smtp>mail.*.com</mail_smtp>
<mail_from>**.li@*.com</mail_from>
<mail_auth>true</mail_auth>
<mail_user>**.li</mail_user>
<mail_password>123456</mail_password>
<mail_contenttype>text/plain</mail_contenttype>
<mail_zipattatched>true</mail_zipattatched>
</querybuilder>
这个文件我直接放到了web-inf下了
需要设计一个分析xml的类,取出值
!-- 发送邮件时使用-->
<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
<property name="host"><value>mail.*.com</value></property>
</bean>
<bean id="mailService" class="com.hinge.bi.service.scheduler.impl.EMailService">
<property name="sender"><ref bean="mailSender"/></property>
</bean>
不知道是否合乎你的要求
"http://www.springframework.org/dtd/spring-beans.dtd"><beans> <bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
<property name="host" value="smtp.gmail.com"></property>
<property name = "port" value = "465"/>
<property name = "username" value = "username"/>
<property name = "password" value="password"/>
<property name="javaMailProperties">
<props>
<prop key="mail.smtp.auth">true</prop>
<prop key="mail.smtp.starttls.enable">true</prop>
<prop key="mail.smtp.socketFactory.class">javax.net.ssl.SSLSocketFactory</prop>
</props>
</property>
</bean></beans>