Spring 我想在我的系统中添加一个自动统计工作量(从数据库中)结果mail给多人;可是邮箱是需要使用代理的,以及我邮箱的帐号密码的;这块通过配置哪块来实现啊?

解决方案 »

  1.   

    这是我们用到这块时的处理:我们是单独设置了一个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的类,取出值
      

  2.   

    然后在spring的配置文件中配置了
    !-- 发送邮件时使用-->
    <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>
    不知道是否合乎你的要求
      

  3.   

    <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" 
    "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>